class MultiPublisher:
Constructor: MultiPublisher(topic, msg_type, latched_client_id, queue_size)
Keeps track of the clients that are using a particular publisher.
Provides an API to publish messages and register clients that are using this publisher
Method | __init__ |
Register a publisher on the specified topic. |
Method | has |
Return true if there are clients to this publisher. |
Method | publish |
Publish a message using this publisher. |
Method | register |
Register the specified client as a client of this publisher. |
Method | unregister |
Unregisters the publisher and clears the clients |
Method | unregister |
Unregister the specified client from this publisher. |
Method | verify |
Verify that the publisher publishes messages of the specified type. |
Instance Variable | clients |
Undocumented |
Instance Variable | latched |
Undocumented |
Instance Variable | listener |
Undocumented |
Instance Variable | msg |
Undocumented |
Instance Variable | publisher |
Undocumented |
Instance Variable | topic |
Undocumented |
Register a publisher on the specified topic.
Keyword arguments: topic -- the name of the topic to register the publisher to msg_type -- (optional) the type to register the publisher as. If not provided, an attempt will be made to infer the topic type latch -- (optional) if a client requested this publisher to be latched,
provide the client_id of that client here
Throws: TopicNotEstablishedException -- if no msg_type was specified by the caller and the topic is not yet established, so a topic type cannot be inferred TypeConflictException -- if the msg_type was specified by the caller and the topic is established, and the established type is different to the user-specified msg_type
Publish a message using this publisher.
Keyword arguments: msg -- the dict (json) message to publish
Throws: Exception -- propagates exceptions from message conversion if the provided msg does not properly conform to the message type of this publisher
Register the specified client as a client of this publisher.
Keyword arguments: client_id -- the ID of the client using the publisher
Unregister the specified client from this publisher.
If the specified client_id is not a client of this publisher, nothing happens.
Keyword arguments: client_id -- the ID of the client to remove