nvflare.fuel.data_event.pub_sub module¶
- class EventPubSub[source]¶
Bases:
object
- publish(topics: List[str], datum: Any) None [source]¶
Publish a message to one or more topics, notifying all subscribed callbacks.
- Parameters:
topics (List[str]) – A list of topics to publish the message to.
datum (Any) – The message to be published to the specified topics.
- subscribe(topics: List[str], callback: Callable[[str, Any, DataBus], None]) None [source]¶
Subscribe a callback function to one or more topics.
- Parameters:
topics (List[str]) – A list of topics to subscribe to.
callback (Callable) – The callback function to be called when messages are published to the subscribed topics.