SimpleMessageListenerContainer
オプションを除くと、コンシューマは一時キュー用に作成されません。私は次のコードhere.なぜ消費者がActiveMQ Temp Queue用に作成されないのですか?
に直面していましたが
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されていないいくつかの問題のためにSimpleMessageListenerContainer
を使用することはありません が働いている:キューがいるようだ - ブタそれは永続的なキューを作成working.butある(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();
です。だから、私は一時的なキューの返信先を直接使用して、それは動作していません。
「作成されていない」とはどういう意味ですか?CreateConsumer()は例外をスローするか、nullを返しますか? –
エラーはまったくありません。私がwebconsoleに見ると、たとえtempキューも2番目のコード用に作成されていません.3番目のコードでは、コンシューマだけが作成されません。 –
NMSプロジェクトの実例を示すNUnitテストの例を追加しました。 –