Skip to content

Instantly share code, notes, and snippets.

@amitsaha
Created November 16, 2012 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitsaha/4084294 to your computer and use it in GitHub Desktop.
Save amitsaha/4084294 to your computer and use it in GitHub Desktop.
Naive Consumer of Fedora Infra Bus
#!/usr/bin/env python
# Naive consuming, courtesy: threebean
# http://fedmsg.readthedocs.org/en/latest/consuming/#naive-consuming
import fedmsg
config = fedmsg.config.load_config([], None)
# Disable that warning about not sending. We know. We only want to tail.
config['mute'] = True
# Disable timing out so that we can tail forever. This is deprecated and will
# disappear in future versions.
config['timeout'] = 0
with open('messages','w') as f:
for name, endpoint, topic, msg in fedmsg.tail_messages(**config):
print name, topic, msg # or use fedmsg.encoding.pretty_dumps(msg)
f.write(name + ':' + topic + '\n')
f.write(str(msg) + '\n')
f.write('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment