Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 4. Examples
This chapter demonstrates the use of AMQ Python through example programs.
For more examples, see the AMQ Python example suite and the Qpid Proton Python examples.
4.1. Sending messages Copier lienLien copié sur presse-papiers!
This client program connects to a server using <connection-url>
, creates a sender for target <address>
, sends a message containing <message-body>
, closes the connection, and exits.
Example: Sending messages
Running the example
To run the example program, copy it to a local file and invoke it using the python
command. For more information, see Chapter 3, Getting started.
python send.py amqp://localhost queue1 hello
$ python send.py amqp://localhost queue1 hello
4.2. Receiving messages Copier lienLien copié sur presse-papiers!
This client program connects to a server using <connection-url>
, creates a receiver for source <address>
, and receives messages until it is terminated or it reaches <count>
messages.
Example: Receiving messages
Running the example
To run the example program, copy it to a local file and invoke it using the python
command. For more information, see Chapter 3, Getting started.
python receive.py amqp://localhost queue1
$ python receive.py amqp://localhost queue1