Created
May 22, 2015 11:19
-
-
Save dsuch/c4d6b457e6dd7b90d989 to your computer and use it in GitHub Desktop.
Obtaining self.broker_client without self
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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