Skip to content

Commit

Permalink
Merge pull request #35 from mokshaproject/stomp-headers
Browse files Browse the repository at this point in the history
Pass STOMP headers along to consumers.
  • Loading branch information
lmacken committed Apr 28, 2016
2 parents c85a0e7 + 53cfe1c commit 433df3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions moksha.hub/moksha/hub/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def consume_amqp_message(self, message):
def consume_stomp_message(self, message):
from moksha.hub.reactor import reactor

topic = message['headers'].get('destination')
headers = message['headers']
topic = headers.get('destination')
if not topic:
log.debug("Got message without a topic: %r" % message)
return
Expand All @@ -204,8 +205,9 @@ def consume_stomp_message(self, message):
body = message['body']

# feed all of our consumers
envelope = {'body': body, 'topic': topic, 'headers': headers}
for callback in self.topics.get(topic, []):
reactor.callInThread(callback, {'body': body, 'topic': topic})
reactor.callInThread(callback, envelope)


class CentralMokshaHub(MokshaHub):
Expand Down

0 comments on commit 433df3e

Please sign in to comment.