Skip to content

Instantly share code, notes, and snippets.

@dsuch
Created May 22, 2015 11:19
Show Gist options
  • Save dsuch/c4d6b457e6dd7b90d989 to your computer and use it in GitHub Desktop.
Save dsuch/c4d6b457e6dd7b90d989 to your computer and use it in GitHub Desktop.
Obtaining self.broker_client without self
# stdlib
import gc
# Zato
from zato.common.broker_message import SERVICE
from zato.common.util import new_cid
from zato.server.base.parallel import ParallelServer
from zato.server.service import Integer, Service
class MyService(Service):
@staticmethod
def after_add_to_store(logger):
for item in gc.get_objects():
if isinstance(item, ParallelServer):
msg = {
'action': SERVICE.PUBLISH.value,
'service': 'zato.helpers.input-logger',
'payload': 'Hello from after_add_to_store',
'cid': new_cid()
}
item.broker_client.publish(msg)
def handle(self):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment