2017-10-27 2 views
0

난 그냥 RabbitMQ에 대한 간단한 테스트를하려고하는데, Erlang이 설치되어 있고 RabbitMQ가 실행 중입니다. 내 수신기 :이 "channel.queueDeclare"라인에 큐를 선언 걸리면 때문에RabbitMQ 대기열 선언이 끝나지 않습니다

private final static String QUEUE_NAME = "hello"; 

public static void main(String[] argv) throws Exception { 
    ConnectionFactory factory = new ConnectionFactory(); 
    factory.setHost("localhost"); 
    Connection connection = factory.newConnection(); 
    Channel channel = connection.createChannel(); 

    channel.queueDeclare(QUEUE_NAME, false, false, false, null); 
    System.out.println(" [*] Waiting for messages. To exit press CTRL+C"); 

    Consumer consumer = new DefaultConsumer(channel) { 
    @Override 
     public void handleDelivery(String consumerTag, Envelope envelope, 
       BasicProperties properties, byte[] body) throws IOException 
     { 
      // TODO Auto-generated method stub 
      String message = new String(body, "UTF-8"); 
      System.out.println(" [x] Received '" + message + "'"); 
     } 
    }; 
    channel.basicConsume(QUEUE_NAME, true, consumer); 
} 

그것은 첫 번째 SYSOUT를 출력하지 않습니다. 토끼 로그는 AMQP 연결을 수락하고 사용자 게스트가 인증을 받고 가상 호스트에 대한 액세스 권한을 부여 받았다고 말합니다.

도움을 주시면 감사하겠습니다.

답변

0

난 그냥 복사/아무 문제없이 코드 ...

[*] Waiting for messages. To exit press CTRL+C 
[x] Received 'foo' 

붙여 난 당신이 관리 플러그인을 활성화하고 관리자 UI를 탐험하는 것이 좋습니다.

태그를 추가 한 이유는이 질문이 Spring과 아무 관련이 없으며 기본 클라이언트를 직접 사용하고 있기 때문입니다.

+0

감사합니다. 태그를 수정했습니다. 이제 관리 플러그인을 활성화하고 관리자 UI를 탐색하려면 어떻게해야합니까? – Camilo

+0

https://www.rabbitmq.com/management.html –

관련 문제