이것은 내 코드이며, autoDelete와 autoDelete 모두에 대해 true로 설정합니다. 교환은 마침내 소비자에게 자동으로 소비자 측에 메시지를 보내지 않습니다. 어쩌면 당신은 내 문장을 완벽하게 이해하지 못할 수도 있습니다.RABBITMQ에서 소비자 측의 시간을 설정하는 방법
어떻게 설정 할 수 있습니다 ^^ 그
과 어떻게 서버 측의 문서 개체 (문서)를받을 수 있나요
public void initConsumer() {
try {
ConnectionFactory factory = new ConnectionFactory();
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare(this.queueName, this.maintain, false, this.queueAutoDelete, null);
channel.exchangeDeclare(this.exchangeName, this.exchangeType, this.maintain, this.exchangeAutoDelete, null);
channel.queueBind(this.queueName, this.exchangeName, this.routingKey);
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(this.queueName, false, consumer);
while (true) {
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
System.out.println(" [x] Received "
+ new String(delivery.getBody()));
channel
.basicAck(delivery.getEnvelope().getDeliveryTag(),
false);
}
} catch (Exception e) {
System.out.println("Exception error at initConsumer()");
}
}
나는 몇 분 안에 브로커로부터 메시지를받지 못하면 어떻게 자동으로 내 컴퓨터를 종료 할 수 있습니까? 그 맞습니까? –
예는 브로커로부터 메시지를 수신하지 않습니다. 그 때 – BillyLee
나는 comsumer 측면을 중지하고 싶습니다. 시간을 설정하십시오. – BillyLee