I have a synchronous message transaction within my system, and the process broadly follows this flow:
...
This process can take anything from a split second to several seconds to accomplish.
I need to use the name of the return destination (destination 2), rather than the full IDestination object, as I have to serialize the object and store in the DB.
If I use a permanent queue or a topic as destination 2, the process works fine. However, it always fails when attempting to create it using the string name of the temporary queue.
There are no errors, the message just fails to arrive
Any ideas why?
Example code for sending return message shown:
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" is the work object - which contains the ReplyTo address and other information)
A temporary destination is just that, temporary. Once the Connection object that created the Temporary Destination closes, the destination is automatically removed from the broker. Storing the temp destination for later use is not a good idea for this reason. Also, only the Connection that created the temp destination is allowed to consume on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With