Skip to content

Instantly share code, notes, and snippets.

@codephillip
Created January 28, 2022 11:28
Show Gist options
  • Save codephillip/71ed38e3f721579a87c5405aaf37c52e to your computer and use it in GitHub Desktop.
Save codephillip/71ed38e3f721579a87c5405aaf37c52e to your computer and use it in GitHub Desktop.

Revisions

  1. codephillip created this gist Jan 28, 2022.
    12 changes: 12 additions & 0 deletions event_publisher.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    from ms_foobar_app.events.event_bus_root import EventBus


    class EventPublisher(EventBus):
    def __init__(self):
    super(EventPublisher, self).__init__()

    def publish(self, subject, data):
    self.loop.run_until_complete(self.__publish(subject, data))

    async def __publish(self, subject, data):
    await self.sc.publish(subject, self.byte_encode_data(data))