Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

A small excursion with Messenger, Dispatch, and management

$
0
0
I was trying a few things out, and I found some problems. I've noted some
below inline with the jiras I created for them.

The messenger namespace problem: The absence of a package for messenger,
with only the things the API user needs to care about, is a disservice to
users. Right now the advice to users is to pay attention to the
enumeration [Messenger, Message, and Data], and try to ignore the other
stuff. It seems like we might add Subscription to that list, and pretty
soon we're going to really wish we had *one place* to sum up what the
messenger API is.

Dispatch doesn't seem to fail in any visible way when I send it garbage
operations. It just goes silent.

Justin

Colorful version: https://gist.github.com/ssorj/9816089

#!/usr/bin/env python

from proton import Message, Messenger
from pprint import pprint

def main():
msgr = Messenger()
msgr.start()

try:
# PROTON-439 "#" syntax not documented
sub = msgr.subscribe("amqp://0.0.0.0/#")
# PROTON-544 Subscriptions have no documentation

msg = Message()

# DISPATCH-38 msg.address = "amqp://0.0.0.0/$management"
msg.address = "amqp://0.0.0.0/_local/$management"
msg.reply_to = sub.address

msg.properties = dict() # PROTON-542
msg.properties["operation"] = "GET-ATTRIBUTES"
msg.properties["name"] = "self"

msgr.put(msg)

msgr.send(1)
msgr.recv(1)

msgr.get(msg)

print "Message properties"
pprint(msg.properties)

print "Management properties"
pprint(msg.body)

msgr.accept()
finally:
msgr.stop()

if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass

Viewing all articles
Browse latest Browse all 5648

Trending Articles