검색

4.3. 테스트 메시지 생성 및 사용

download PDF

브로커를 시작한 후 올바르게 실행되고 있는지 확인해야 합니다. 여기에는 몇 가지 테스트 메시지를 생성하고 브로커로 보낸 후 소비해야 합니다.

절차

  1. artemis producer 명령을 사용하여 몇 가지 테스트 메시지를 생성하고 브로커로 보냅니다.

    이 명령은 브로커에서 자동으로 생성된 helloworld 주소로 100개의 메시지를 보냅니다. 생산자는 지원되는 모든 메시징 프로토콜을 허용하는 기본 포트 61616을 사용하여 브로커에 연결합니다.

    $ /opt/redhat/amq-broker/amq-broker-7.2.0/bin/artemis producer --destination helloworld --message-count 100 --url tcp://localhost:61616
    Producer ActiveMQQueue[helloworld], thread=0 Started to calculate elapsed time ...
    
    Producer ActiveMQQueue[helloworld], thread=0 Produced: 100 messages
    Producer ActiveMQQueue[helloworld], thread=0 Elapsed time in second : 1 s
    Producer ActiveMQQueue[helloworld], thread=0 Elapsed time in milli second : 1289 milli seconds
  2. 웹 콘솔을 사용하여 브로커에 저장된 메시지를 확인합니다.

    1. 웹 브라우저에서 http://localhost:8161 로 이동합니다.
    2. 브로커 인스턴스를 만들 때 생성한 기본 사용자 이름 및 기본 암호를 사용하여 콘솔에 로그인합니다.

      특성 탭이 표시됩니다.

    3. Attributes 탭에서 address helloworld 대기열 "anycast" helloworld 로 이동합니다.

      이전 단계에서는 메시지를 helloworld 주소로 전송했습니다. 이로 인해 큐( helloworld 라고도 함)를 사용하여 새 anycast helloworld주소가 생성되었습니다. Message count 특성은 helloworld 로 전송된 100개의 모든 메시지가 현재 이 큐에 저장됨을 보여줍니다.

      그림 4.1. 메시지 수

      메시지 수
  3. artemis consumer 명령을 사용하여 브로커에 저장된 메시지의 50개를 사용합니다.

    이 명령은 이전에 브로커에 보낸 메시지의 50개를 사용합니다.

    $ /opt/redhat/amq-broker/amq-broker-7.2.0/bin/artemis consumer --destination helloworld --message-count 50 --url tcp://localhost:61616
    
    Consumer:: filter = null
    Consumer ActiveMQQueue[helloworld], thread=0 wait until 50 messages are consumed
    Consumer ActiveMQQueue[helloworld], thread=0 Consumed: 50 messages
    Consumer ActiveMQQueue[helloworld], thread=0 Consumer thread finished
  4. 웹 콘솔에서 Message count 가 이제 50인지 확인합니다.

    50개의 메시지가 사용되었으며, 이 경우 helloworld 큐에 저장된 50개의 메시지가 남습니다.

  5. 브로커를 중지하고 나머지 50개의 메시지가 여전히 helloworld 큐에 저장되었는지 확인합니다.

    1. 브로커가 실행 중인 터미널에서 Ctrl+C 를 눌러 브로커를 중지합니다.
    2. 브로커를 다시 시작합니다.

      $ /var/opt/amq-broker/mybroker/bin/artemis run
    3. 웹 콘솔에서 helloworld 대기열로 돌아가 큐에 아직 50개의 메시지가 저장되어 있는지 확인합니다.
  6. 나머지 50개의 메시지를 사용합니다.

    $ /opt/redhat/amq-broker/amq-broker-7.2.0/bin/artemis consumer --destination helloworld --message-count 50 --url tcp://localhost:61616
    
    Consumer:: filter = null
    Consumer ActiveMQQueue[helloworld], thread=0 wait until 50 messages are consumed
    Consumer ActiveMQQueue[helloworld], thread=0 Consumed: 50 messages
    Consumer ActiveMQQueue[helloworld], thread=0 Consumer thread finished
  7. 웹 콘솔에서 메시지 수가 0인지 확인합니다.

    helloworld 큐에 저장된 모든 메시지가 사용되었으며 대기열이 비어 있습니다.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

© 2024 Red Hat, Inc.