[英]ActiveMQ - Sending a message to a temporary queue specified using a string (NMS in C#)
我的系统中有一个同步消息事务,该过程大致遵循以下流程:
...
这个过程可以从一秒到几秒完成任何事情。
我需要使用返回目标(目标2)的名称,而不是完整的IDestination对象,因为我必须序列化对象并存储在数据库中。
如果我使用永久队列或主题作为目标2,则该过程正常。 但是,尝试使用临时队列的字符串名称创建它时总是会失败。
没有错误,消息无法到达
有什么想法吗?
显示发送返回消息的示例代码:
IDestination myDestination = SessionUtil.GetDestination(stateSession, instance.ReplyTo, DestinationType.Queue);
stateConnection.Start();
using (IMessageProducer myProducer = stateSession.CreateProducer(myDestination))
{
myProducer.DeliveryMode = MsgDeliveryMode.NonPersistent;
var response = myProducer.CreateTextMessage();
response.NMSCorrelationID = instance.CorrelationID;
response.Properties["RoutingDestination"] = instance.RoutingOriginator;
response.Text = "Test Response";
try
{
myProducerBroadcast.Send(response);
myProducer.Send(response);
Log.InfoFormat("Sent response {0} to {1}", instance.UniqueId, instance.ReplyTo);
}
catch (Exception ex)
{
Log.Error("Unable to send execution update onwards", ex);
}
}
(“instance”是工作对象 - 其中包含ReplyTo地址和其他信息)
临时目的地就是临时目的地。 创建临时目标的Connection对象关闭后,将自动从代理中删除目标。 出于这个原因,存储临时目的地以供以后使用并不是一个好主意。 此外,只允许在其上使用创建临时目标的Connection。
如果代理配置为不使用“advisorySupport”,我确实注意到临时队列不起作用
重新启用让队列为我工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.