ActiveMQ - sending a message to a temporary queue specified using a string (NMS in C #)

I have a synchronous message transaction on my system, and the process as a whole follows this thread:

  • โ€œPoint Aโ€ creates a temporary queue (โ€œdestination 2โ€) in the message broker;
  • A message sent from point A to destination 1 (normal queue in a message broker) with a ReplyTo address specified as destination 2;
  • point A blocks awaiting a response to destination 2;
  • point B receives a message from destination 1;
  • point B creates a work object - whose property is the destination name 2 (obtained using .ToString () ". This work object is serialized and stored in the database;

...

  • The object obtained from the database during the execution of certain parameters, changes ocurr, and the response is sent to destination 2 - using SessionUtil to get a new IDestination object from the response address stored as a property of the work object string;
  • Point A receives a message from destination 2 and continues.

This process can take anywhere from two seconds to several seconds.

I need to use the name of the return destination (destination 2) and not the full IDestination object, since I need to serialize the object and save it to the database.

If I use a constant queue or topic as destination 2, the process is working fine. However, it always fails when trying to create it using the time queue string name.

There are no errors, the message just does not come

Any ideas why?

:

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);
}                
}

( "" - , ReplyTo )

+3
2

- . Connection, , , . . , , temp.

+4

, , , "advisorySupport"

, .

0
source

Source: https://habr.com/ru/post/1786095/


All Articles