Skip to content
Snippets Groups Projects
Commit 4c3ada95 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #7508: Fixed tPyMsgBus, and test both sending a new message and resending a received message

parent 4c8711a6
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python #!/usr/bin/python
from lofar.messagebus.msgbus import FromBus, ToBus from lofar.messagebus.msgbus import FromBus, ToBus
from lofar.messagebus.message import Message from lofar.messagebus.message import Message, MessageContent
# Send a message # Send a message (send MessageContent)
tbus = ToBus("test") tbus = ToBus("test")
tmsg = Message() tmsg = MessageContent()
tmsg.payload = "foo" tmsg.payload = "foo"
tbus.send(tmsg) tbus.send(tmsg)
# Receive it # Receive it
fbus = FromBus("test") fbus = FromBus("test")
fmsg = fbus.get(1) fmsg = fbus.get(1)
# Verify the content
assert fmsg != None assert fmsg != None
assert fmsg.content().payload == "foo"
# Resend it! (send Message)
tbus.send(fmsg)
rmsg = fbus.get(1)
# Verify the content # Verify the content
assert fmsg.payload == "foo" assert rmsg != None
assert rmsg.content().payload == "foo"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment