이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 4. Examples
This chapter demonstrates the use of AMQ Ruby through example programs.
For more examples, see the AMQ Ruby example suite.
4.1. Sending messages 링크 복사링크가 클립보드에 복사되었습니다!
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 ruby
command.
ruby send.rb amqp://localhost queue1 hello
$ ruby send.rb amqp://localhost queue1 hello
4.2. Receiving messages 링크 복사링크가 클립보드에 복사되었습니다!
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 ruby
command.
ruby receive.rb amqp://localhost queue1
$ ruby receive.rb amqp://localhost queue1