AMQP 1.0 messaging example programs implemented using a variety of messaging APIs
- connect - Connect to a messaging server
- send - Send a message
- receive - Receive messages
- request - Send a request and receive a response
- respond - Receive requests and send responses
Establish a connection, print to the console when connected, and exit.
Usage: connect <connection-url>
$ python connect.py amqp://example.net
CONNECT: Connected to 'amqp://example.net'
Send one message and exit.
Usage: send <connection-url> <address> <message-body>
$ python send.py amqp://example.net examples "Hello there"
SEND: Connected to 'amqp://example.net'
SEND: Opened sender for target address 'examples'
SEND: Sent message 'Hello there'
Receive messages until the program is terminated. If specified, exit
after <message-count>
messages are received.
Usage: receive <connection-url> <address> [<message-count>]
$ python receive.py amqp://example.net examples
RECEIVE: Connected to 'amqp://example.net'
RECEIVE: Opened receiver for source address 'examples'
RECEIVE: Received message 'Hello there'
Send one request, receive the response, print the response to the console, and exit.
Usage: request <connection-url> <address> <message-body>
$ python request.py amqp://example.net examples "abcdef"
REQUEST: Connected to 'amqp://example.net'
REQUEST: Opened sender for target address 'examples'
REQUEST: Sent request message 'abcdef'
REQUEST: Received response message 'ABCDEF'
Receive requests and send responses until the program is terminated.
If specified, exit after <message-count>
messages are received.
Usage: respond <connection-url> <address> [<message-count>]
$ python respond.py amqp://example.net examples
RESPOND: Connected to 'amqp://example.net'
RESPOND: Opened receiver for source address 'examples'
RESPOND: Received request message 'abcdef'
RESPOND: Sent response message 'ABCDEF'
- Basic examples (in the root dir or 'basic')
- connect
- send
- receive
- request
- respond
- Acknowledgment
- receive
- Authentication (authentication)
- password
- kerberos
- Automatic resource creation (auto-create)
- queue-send
- queue-receive
- topic-send
- topic-receive
- Reconnect and failover (reconnect)
- connect
- failover
- custom-failover
- Servers (servers)
- receive
- respond
- Subscriptions (subscriptions)
- subscribe
- durable-subscribe
- shared-subscribe
- durable-shared-subscribe
- TLS (tls)
- connect
- Error handling (error-handling)
- Filters (filters)
- Interoperating with JMS (jms-interop)
- Logging (logging)
- Message content (message-content)
- Message groups (message-groups)
- Multithreaded applications (threading)
- Timers (timers)
- Tracing (tracing)
- Codec (codec)
- IO integration (io-integration)
-
The most basic sending programs send one message and then exit.
-
By default, receiving programs keep running until the user terminates them. If the optional MESSAGE-COUNT argument is supplied, they exit after the given number of messages have been received.
-
Each example program is contained in a single file, with exceptions where necessary.
-
Option parsing is deliberately simple, using positional arguments.