이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 4. Getting Started


Before configuring AMQ Interconnect, you should understand how to start the router, how it is configured by default, and how to use it in a simple peer-to-peer configuration.

4.1. Starting the Router

Procedure

  1. To start the router with the default configuration, do one of the following:

    Expand
    To…​Enter this command…​

    Run the router as a service in Red Hat Enterprise Linux 6

    $ sudo service qdrouterd start
    Copy to Clipboard Toggle word wrap

    Run the router as a service in Red Hat Enterprise Linux 7

    $ systemctl start qdrouterd.service
    Copy to Clipboard Toggle word wrap

    Run the router as a daemon

    $ qdrouterd -d
    Copy to Clipboard Toggle word wrap

    To start the router in the foreground, do not use the -d parameter.

    Note

    You can specify a different configuration file with which to start the router. For more information, see Changing a Router’s Configuration.

    The router starts, using the default configuration file stored at /etc/qpid-dispatch/qdrouterd.conf.

  2. View the log to verify the router status:

    $ qdstat --log
    Copy to Clipboard Toggle word wrap

    This example shows that the router was correctly installed, is running, and is ready to route traffic between clients:

    $ qdstat --log
    Fri May 20 09:38:03 2017 SERVER (info) Container Name: Router.A 
    1
    
    Fri May 20 09:38:03 2017 ROUTER (info) Router started in Standalone mode 
    2
    
    Fri May 20 09:38:03 2017 ROUTER (info) Router Core thread running. 0/Router.A
    Fri May 20 09:38:03 2017 ROUTER (info) In-process subscription M/$management
    Fri May 20 09:38:03 2017 AGENT (info) Activating management agent on $_management_internal 
    3
    
    Fri May 20 09:38:03 2017 ROUTER (info) In-process subscription L/$management
    Fri May 20 09:38:03 2017 ROUTER (info) In-process subscription L/$_management_internal
    Fri May 20 09:38:03 2017 DISPLAYNAME (info) Activating DisplayNameService on $displayname
    Fri May 20 09:38:03 2017 ROUTER (info) In-process subscription L/$displayname
    Fri May 20 09:38:03 2017 CONN_MGR (info) Configured Listener: 0.0.0.0:amqp proto=any role=normal 
    4
    
    Fri May 20 09:38:03 2017 POLICY (info) Policy configured maximumConnections: 0, policyFolder: '', access rules enabled: 'false'
    Fri May 20 09:38:03 2017 POLICY (info) Policy fallback defaultApplication is disabled
    Fri May 20 09:38:03 2017 SERVER (info) Operational, 4 Threads Running 
    5
    Copy to Clipboard Toggle word wrap
    1
    The name of this router instance.
    2
    By default, the router starts in standalone mode, which means that it cannot connect to other routers or be used in a router network.
    3
    The management agent. It provides the $management address, through which management tools such as qdmanage and qdstat can perform create, read, update, and delete (CRUD) operations on the router. As an AMQP endpoint, the management agent supports all operations defined by the AMQP management specification (Draft 9).
    4
    A listener is started on all available network interfaces and listens for connections on the standard AMQP port (5672, which is not encrypted).
    5
    Threads for handling message traffic and all other internal operations.

4.2. Routing Messages in a Peer-to-Peer Configuration

This example demonstrates how the router can connect clients by receiving and sending messages between them. It uses the router’s default configuration file and does not require a broker.

Figure 4.1. Peer-to-peer Communication

As the diagram indicates, the configuration consists of an AMQ Interconnect component with two clients connected to it: a sender and a receiver. The receiver wants to receive messages on a specific address, and the sender sends messages to that address.

A broker is not used in this example, so there is no "store and forward" mechanism in the middle. Instead, the messages flow from sender to receiver only if the receiver is online, and the sender can confirm that the messages have arrived at their destination.

This example uses a AMQ Python client to start a receiver client, and then send five messages from the sender client.

Prerequisites

AMQ Python must be installed before you can complete the peer-to-peer routing example. For more information, see {ClientAmqpPythonUrl}.

4.2.1. Starting the Receiver Client

In this example, the receiver client is started first. This means that the messages will be sent as soon as the sender client is started.

Note

In practice, the order in which you start senders and receivers does not matter. In both cases, messages will be sent as soon as the receiver comes online.

Procedure

  • To start the receiver by using the Python receiver client, navigate to the Python examples directory and run the simple_recv.py example:

    $ cd INSTALL_DIR/examples/python/
    $ python simple_recv.py -a 127.0.0.1:5672/examples -m 5
    Copy to Clipboard Toggle word wrap

    This command starts the receiver and listens on the default address (127.0.0.1:5672/examples). The receiver is also set to receive a maximum of five messages.

4.2.2. Sending Messages

After starting the receiver client, you can send messages from the sender. These messages will travel through the router to the receiver.

Procedure

  • In a new terminal window, navigate to the Python examples directory and run the simple_send.py example:

    $ cd INSTALL_DIR/examples/python/
    $ python simple_send.py -a 127.0.0.1:5672/examples -m 5
    Copy to Clipboard Toggle word wrap

    This command sends five auto-generated messages to the default address (127.0.0.1:5672/examples) and then confirms that they were delivered and acknowledged by the receiver:

    all messages confirmed
    Copy to Clipboard Toggle word wrap

    The receiver client receives the messages and displays their content:

    {u'sequence': 1L}
    {u'sequence': 2L}
    {u'sequence': 3L}
    {u'sequence': 4L}
    {u'sequence': 5L}
    Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat