我的系统中有一个同步消息事务,该过程大致遵循以下流程:
...
这个过程可以从一秒钟到几秒钟完成任务。
我需要使用返回目标(目标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地址和其他信息)
答案 0 :(得分:4)
临时目的地就是临时目的地。创建临时目标的Connection对象关闭后,将自动从代理中删除目标。出于这个原因,存储临时目的地以供以后使用并不是一个好主意。此外,只允许在其上使用创建临时目标的Connection。
答案 1 :(得分:0)
如果代理配置为不使用“advisorySupport”
,我确实注意到临时队列不起作用
重新启用让队列为我工作。