Guest User

Untitled

a guest
May 2nd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import qpid
  2. import sys
  3. import os
  4. from qpid.util import connect
  5. from qpid.connection import Connection
  6. from qpid.datatypes import Message
  7. from qpid.datatypes import uuid4
  8. from qpid.queue import Empty
  9.  
  10. host = "127.0.0.1"
  11. port = 5672
  12. user = "guest"
  13. password = "guest"
  14.  
  15. socket = connect(host, port)
  16. connection = Connection (sock = socket, username = user, password = password)
  17. connection.start()
  18. session = connection.session(str(uuid4()))
  19. props = session.delivery_properties(routing_key = "routing_key")
  20. session.message_transfer(destination = "amq.direct", message = Message(props, "Teste do MRG Messaging"))
  21.  
  22. session.close(timeout = 10)
  23. print "Mensagem enviada com sucesso!"
Add Comment
Please, Sign In to add comment