Beispiel #1
0

topic = MessageTopic()
topic.send(message1)
print topic.messages.queue

topic.attach(topichandler1)
topic.send(message2)
print topic.messages.queue

topic.attach(topichandler2)
topic.send(message3)
print topic.messages.queue

queue = MessageQueue("test-channel")
queue.send(message1)
print queue.messages.queue

queue.send(message2)
print queue.messages.queue

print queue.receive()
queue.attach(queuehandler1)
print queue.messages.queue

queue.send(message1)
queue.send(message2)
queue.send(message3)
queue.send(message4)
print queue.messages.queue
Beispiel #2
0
tstop = time.time()
print "Took %0.3f seconds put/get %d things" % (tstop - tstart, i)
# Took 9.897 seconds put/get 999 things


import time
from mpx.lib.message.types import Message
from mpx.lib.messaging.channel.queue import MessageQueue
Thing = Message()
Thing.setheader("DEST", "//urchin/node-commands")
channel = MessageQueue("Name")

tstart = time.time()
for i in xrange(1000):
    channel.send(Thing)
    thing = channel.receive()


tstop = time.time()
print "Took %0.3f seconds send/receive %d messages" % (tstop - tstart, i)
# Took 1.052 seconds put/get 999 things



import time
from mpx.lib.message.data import SimpleMessage
from mpx.lib.messaging.channel.queue import MessageQueue
Thing = SimpleMessage("Data")
Thing.setheader("DEST", "//urchin/node-commands")
Beispiel #3
0
        queues[x].put(thing)

tstop = time.time()
print "Took %0.3f seconds put/get %d things" % (tstop - tstart, i)
# Took 9.897 seconds put/get 999 things

import time
from mpx.lib.message.types import Message
from mpx.lib.messaging.channel.queue import MessageQueue
Thing = Message()
Thing.setheader("DEST", "//urchin/node-commands")
channel = MessageQueue("Name")

tstart = time.time()
for i in xrange(1000):
    channel.send(Thing)
    thing = channel.receive()

tstop = time.time()
print "Took %0.3f seconds send/receive %d messages" % (tstop - tstart, i)
# Took 1.052 seconds put/get 999 things

import time
from mpx.lib.message.data import SimpleMessage
from mpx.lib.messaging.channel.queue import MessageQueue
Thing = SimpleMessage("Data")
Thing.setheader("DEST", "//urchin/node-commands")

tstart = time.time()
thing = Thing.copy()
for i in xrange(1, 1000):
Beispiel #4
0
queuehandler2 = Listener("Queue Listener 2", showcallback)

topic = MessageTopic()
topic.send(message1)
print topic.messages.queue

topic.attach(topichandler1)
topic.send(message2)
print topic.messages.queue

topic.attach(topichandler2)
topic.send(message3)
print topic.messages.queue

queue = MessageQueue("test-channel")
queue.send(message1)
print queue.messages.queue

queue.send(message2)
print queue.messages.queue

print queue.receive()
queue.attach(queuehandler1)
print queue.messages.queue

queue.send(message1)
queue.send(message2)
queue.send(message3)
queue.send(message4)
print queue.messages.queue
Beispiel #5
0







nodeurl = "/interfaces/relay1"
nodemsg = message.NodeMessage(nodeurl)
nodecmd = message.NodeCommand(nodeurl, "invoke", ("get",))

cmdrequest = request.Request(nodecmd)
cmdrequest.setheader("DEST", "//beggar")
cmdrequest.setheader("REPLY-TO", "//beggar")
incoming.send(cmdrequest)
print service_responses.receive(timeout=10).message.data

send(cmdrequest, 1)
recv(1)

cmdrequest = request.Request(nodecmd)
cmdrequest.setheader("DEST", "//urchin")
cmdrequest.setheader("REPLY-TO", "//beggar")

incoming.send(cmdrequest)
print service_responses.receive(timeout=10).message.data

send(cmdrequest, 1)
recv(1)