Apache.NMS ライブラリを使用して ActiveMQ JMS システムと統合しています。応答キュー リスナーの場合、メッセージの受信後にコンシューマーが破棄されるかどうかは明確ではありません。
ソリューションからの抜粋は次のとおりです。
var destination = getDestination(session, Settings.Instance.OutboundQueue);
// Create a consumer and producer
using (var consumer = session.CreateConsumer(destination))
{
// Start the connection so that messages will be processed.
connection.Start();
consumer.Listener += OnMessage;
var receiveTimeout = TimeSpan.FromSeconds(Settings.Instance.Timeout);
// Wait for the message
semaphore.WaitOne((int)receiveTimeout.TotalMilliseconds, true);
}
// The Listener event
protected void OnMessage(IMessage receivedMsg)
{
var message = receivedMsg as ITextMessage;
semaphore.Set();
// process the message
}
消費者は耐久性がありますか?
メッセージを受信した後、再登録する必要がありますか?
これは、リスナーをアクティブに保つために while(true) ループが必要な他のキューイング/リスナー実装 (SQL Server サービス ブローカーまたは TCP/IP リスナー) と似ていますか?