SimpleMessageListenerContainer
옵션을 제외하고 소비자는 임시 대기열에 대해 생성되지 않습니다. 큐가 보인다 -하지만 : 나는 몇 가지 문제에 대한 SimpleMessageListenerContainer
를 사용하지 않습니다 는 (심지어 임시 큐가 생성되지 않음)ActiveMQ 임시 대기열에 대해 소비자가 생성되지 않는 이유는 무엇입니까?
using (IConnection connection = connectionFactory.CreateConnection())
using (ISession session = connection.CreateSession())
{
IDestination destination = SessionUtil.GetDestination(session, aQueueName);
var replyDestination = session.CreateTemporaryQueue();
// Create a consumer and producer
using (IMessageProducer producer = session.CreateProducer(destination))
{
// Start the connection so that messages will be processed.
connection.Start();
IBytesMessage request = session.CreateBytesMessage(aMsg);
request.NMSReplyTo = replyDestination;
IMessageConsumer consumer = session.CreateConsumer(replyDestination);
consumer.Listener += new MessageListener(this.OnAckRecieved);
// Send a message
producer.Send(request);
ack = this.autoEvent.WaitOne(this.msgConsumeTimeOut, true);
consumer.Close();
consumer.Dispose();
ConnectionFactoryUtils.GetTargetSession(session).DeleteDestination(replyDestination);
}
connection.Close();
session.Close();
이
Flollowing 코드가 작동 ... 코드가 작동하지 않는 경우 다음
here.에 직면 영구되지 큐 (NmsDestinationAccessor 사용)와 상기 코드와 임시 큐
using (IConnection connection = connectionFactory.CreateConnection())
using (ISession session = connection.CreateSession())
{
IDestination destination = SessionUtil.GetDestination(session, aQueueName);
var replyDestination = session.CreateTemporaryQueue();
// Create a consumer and producer
using (IMessageProducer producer = session.CreateProducer(destination))
{
// Start the connection so that messages will be processed.
connection.Start();
IBytesMessage request = session.CreateBytesMessage(aMsg);
request.NMSReplyTo = replyDestination;
IDestination tempDestination = this.destinationResolver.ResolveDestinationName(session, request.NMSReplyTo.ToString());
IMessageConsumer consumer = session.CreateConsumer(tempDestination);
consumer.Listener += new MessageListener(this.OnAckRecieved);
// Send a message
producer.Send(request);
ack = this.autoEvent.WaitOne(this.msgConsumeTimeOut, true);
consumer.Close();
consumer.Dispose();
ConnectionFactoryUtils.GetTargetSession(session).DeleteDestination(tempDestination);
}
connection.Close();
session.Close();
그것은 영구 큐를 생성 working.but 그것이하다. 그래서 임시 대기열 답장 대상을 직접 사용하면 작동하지 않습니다.
"작성되지 않음"으로 정확히 무엇을 의미합니까? CreateConsumer()가 예외를 던지거나 null을 반환합니까? –
오류가 전혀 없습니다. webconsole에서 볼 때, 심지어 임시 대기열은 두 번째 코드에 대해 생성되지 않습니다. 세 번째 코드의 경우 소비자 만 생성되지 않습니다. –
NMS 프로젝트에서 예제 NUnit 테스트를 추가하여 실제 상황을 보여주었습니다. –