실행하려는 예제의 디렉터리로 이동합니다. 다음 예제에서는 예제를 amq-broker-examples 라는 디렉터리에 다운로드했다고 가정합니다.
cd amq-broker-examples/examples/features/standard/queue
$ cd amq-broker-examples/examples/features/standard/queue
Copy to ClipboardCopied!Toggle word wrapToggle overflow
mvn clean verify 명령을 사용하여 example 프로그램을 실행합니다.
Maven은 브로커를 시작하고 example 프로그램을 실행합니다. Maven은 예제 프로그램을 처음 실행할 때 누락된 종속성을 다운로드합니다. 이 종속성을 실행하는 데 시간이 걸릴 수 있습니다.
이 경우 큐 예제 프로그램이 실행되어 생산자를 생성하고 테스트 메시지를 보낸 다음 메시지를 수신하는 소비자를 생성합니다.
mvn clean verify
[INFO] Scanning for projects...
[INFO]
[INFO] -------------< org.apache.activemq.examples.broker:queue >--------------
[INFO] Building ActiveMQ Artemis JMS Queue Example 2.6.1.amq-720004-redhat-1
[INFO] --------------------------------[ jar ]---------------------------------
...
server-out:2018-12-05 16:37:57,023 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.6.1.amq-720004-redhat-1 [0.0.0.0, nodeID=06f529d3-f8d6-11e8-9bea-0800271b03bd]
[INFO] Server started
[INFO]
[INFO] --- artemis-maven-plugin:2.6.1.amq-720004-redhat-1:runClient (runClient) @ queue ---
Sent message: This is a text message
Received message: This is a text message
[INFO]
[INFO] --- artemis-maven-plugin:2.6.1.amq-720004-redhat-1:cli (stop) @ queue ---
server-out:2018-12-05 16:37:59,519 INFO [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.6.1.amq-720004-redhat-1 [06f529d3-f8d6-11e8-9bea-0800271b03bd] stopped, uptime 3.734 seconds
server-out:Server stopped!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.681 s
[INFO] Finished at: 2018-12-05T16:37:59-05:00
[INFO] ------------------------------------------------------------------------
$ mvn clean verify
[INFO] Scanning for projects...
[INFO][INFO] -------------< org.apache.activemq.examples.broker:queue >--------------
[INFO] Building ActiveMQ Artemis JMS Queue Example 2.6.1.amq-720004-redhat-1
[INFO] --------------------------------[ jar ]---------------------------------
...
server-out:2018-12-05 16:37:57,023 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.6.1.amq-720004-redhat-1 [0.0.0.0, nodeID=06f529d3-f8d6-11e8-9bea-0800271b03bd][INFO] Server started
[INFO][INFO] --- artemis-maven-plugin:2.6.1.amq-720004-redhat-1:runClient (runClient) @ queue ---
Sent message: This is a text message
Received message: This is a text message
[INFO][INFO] --- artemis-maven-plugin:2.6.1.amq-720004-redhat-1:cli (stop) @ queue ---
server-out:2018-12-05 16:37:59,519 INFO [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.6.1.amq-720004-redhat-1 [06f529d3-f8d6-11e8-9bea-0800271b03bd] stopped, uptime3.734 seconds
server-out:Server stopped![INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.681 s
[INFO] Finished at: 2018-12-05T16:37:59-05:00
[INFO] ------------------------------------------------------------------------
Copy to ClipboardCopied!Toggle word wrapToggle overflow
참고
예제 프로그램 중 일부는 UDP 클러스터링을 사용하며 기본적으로 사용자 환경에서 작동하지 않을 수 있습니다. 이러한 예제를 성공적으로 실행하려면 224.0.0.0으로 전송되는 트래픽을 루프백 인터페이스로 리디렉션합니다.
sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
$ sudo route add-net224.0.0.0 netmask 240.0.0.0 dev lo
Copy to ClipboardCopied!Toggle word wrapToggle overflow