Nameko Cometd Bayeux Client
The library is used by Nameko Salesforce which has been connected to a fairly busy production Salesforce account for over a year and proved robust.
Install from PyPI with
pip install nameko-bayeux-client
Add Bayeux client configuration to your Nameko config file:
# config.yaml BAYEUX: VERSION: 1.0 MINIMUM_VERSION: 1.0 SERVER_URI: http://example.com/cometd
Decorate entrypoint in your service class:
# service.py from nameko_bayeux_client import subscribe class Service: name = 'some-service' @subscribe('/some/topic') def handle_event(self, data): # this entrypoint is fired on incoming events # of '/some/topic' channel print(data)
Run your service, providing the config file:
$ nameko run service --config config.yaml
On start-up, the extension connects to Cometd server, subscribes and starts listening to channels defined by entrypoints.