using stomp.py to send messages to activemq is not displayed in the background
-sharp queue
def send_to_queue(msg):
conn = stomp.Connection10([("192.168.0.143", 61613)])
conn.start()
conn.connect("admin", "admin")
conn.send(queue_name, msg)
conn.disconnect()
there is also a strange problem that if the send and receive methods are called continuously, the message will be received and printed, but if the send is performed first, the message will not be received
-sharp-sharp
def receive_from_queue():
conn = stomp.Connection10([("192.168.0.143", 61613)])
listener = SampleListener(conn)
conn.set_listener(listener_name, listener)
conn.start()
conn.connect("admin", "admin")
conn.subscribe(queue_name)
time.sleep(1) -sharp secs
conn.unsubscribe(queue_name)
conn.disconnect()