Skip to main content

An eventbus that used for FinanGen

Project description

eventbus-py

EventBus的Python实现

Example

  • 调用规范 由于设计时考虑到可能会存在多个实例的情况,故使用ContextVar来包装EventBus实例方便使用者调用。
    from eventbus import bus, Subscribe
    class Example:
      pass
    class A:
      def __init__(self):
        bus.get().register(a)
    
      @Subscribe(priority=100, sticky=True)
      def on_example(self, event: Example):
          bus.get().cancel_delivery(event)
          bus.get().unregister(a)
      
    a = A()
    bus.get().post(a)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eventbus-py-0.0.1.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

eventbus_py-0.0.1-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page