InMemoryTransport.subscribe

InMemoryTransport.subscribe(topic, callback)[source]

Subscribe to a topic.

Every time a new message is received on the topic, the callback will be invoked.

Parameters:
topicTopic

Instance of the topic to subscribe to.

callbackfunction

Callback to invoke whenever a new message arrives. The callback should receive only one msg argument, e.g. lambda msg: print(msg).

Returns:
str

Returns an identifier of the subscription.