MCPcopy Create free account
hub / github.com/StackStorm/st2 / main

Function main

tools/direct_queue_publisher.py:29–44  ·  view source on GitHub ↗
(queue, payload)

Source from the content-addressed store, hash-verified

27
28
29def main(queue, payload):
30 connection = pika.BlockingConnection(
31 pika.ConnectionParameters(
32 host="localhost",
33 credentials=pika.credentials.PlainCredentials(
34 username="guest", password="guest"
35 ),
36 )
37 )
38 channel = connection.channel()
39
40 channel.queue_declare(queue=queue, durable=True)
41
42 channel.basic_publish(exchange="", routing_key=queue, body=payload)
43 print("Sent %s" % payload)
44 connection.close()
45
46
47if __name__ == "__main__":

Callers 1

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected