Is there any way i can acknowledge a message based on the message id only.
My scenario is like this:
A web service received message from activemq with ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE.
Sends this message to the client.
Client sends the acknowledgement after processing it with the message id
Here the requirement is to the webservice should be able to acknowledge the message based on the message id.
Right now, you can only call the acknowledge() method on the respective message object to acknowledge that particular message. But keep in mind that calling the acknowledge() method on a message object which is not present in the broker will cause 'Could not correlate
acknowledgment with dispatched message' exception.
Related
We consume a list of messages from the queue inside ActiveMQ broker and present it to the user so the user can select one message, we are using the .net client implementation based on AMQP.Net Lite (.net 2.1).
AMQ queue messages
If the user wants to select a specific message from the queue, not the one which is the next to consume from the queue, is there any possibility to access that message by the 'MessageId' parameter or some other property?
Something like the code bellow :
Message msgToSend = new Message();
msgToSend.Properties = new Properties() { MessageId = "8589942532"};
receiver.Accept(msgToSend);
The list of messages the user can see from the queue are not accepted so they are still visible in the queue. The idea is to accept the message when the user performese a specific action like clicking a 'save' button.
You can create additional consumer with filter expression, which naturally would filter by message ID, to receive that message. After receiving the message, this consumer would have to go as it would be of no use.
BTW, you can also use non-destructive queues or consumers to browse the queue without removing messages from it (at least this is available in Artemis, not sure about ActiveMQ Classic).
I am trying some stuff about Reliability of message delivery using ConfirmCallback.
So far I've done these:
1.When I send a message, I save it in the db (There is a field called status that indicates whether the message reached the broker successfully). Message id will stored in correlationData.
2.Using ConfirmCallback, if ack, i will update Message#status to success.( I can get message id from CorrelationData )
3.Using timed tasks to find the message that was not sent successfully, and resend.
I wonder why ConfirmCallback#confirm#CorrelationData has only one property id rather than the entire message so that I can resend message immediately.(In this way I don't need to persist messages).
Is there any other way to ensure that the message is sent successfully?
Any Suggestions would be appreciated.
You can sub-class CorrelationData to add the message.
I am trying to create a priority RPC queue that can accept some messages that expect a response and some messages that do not expect a response. The problem I am facing is that when I send messages with convertAndSend I get an error saying "org.springframework.amqp.AmqpException: Cannot determine ReplyTo message property value: Request message does not contain reply-to property, and no default response Exchange was set." I know the issue is that the RPC queue is expecting a response, and the message just stays on the queue, but for these messages I do not want/need a response. Any idea how I can work around this issue?
Thanks,
Brian
A solution recommended in this link worked for me: Single Queue, multiple #RabbitListener but different services. Basically I have a class with RabbitListener, and different methods with RabbitHandler
RPC call and cast are two different types of message passing protocol in OpenStack. In case of RPC.call, the invoker (or caller) waits for the reply or ack messsage from the worker (callee).
I am trying to intercept all RPC messages (both Request & Reply Message) passing through rabbitmq system in OpenStack. In OpenStack all request messages pass through a single exchange named "nova". Attaching a new queue to the "nova" exchange, I can capture request Message.
Now, I want to capture reply messages that are sent back to callee. Reply messages can be captured by "direct Consumer" as specified by AMQP and Nova and excerpt as follows
a Direct Consumer comes to life if (an only if) a rpc.call operation is executed; this object is
instantiated and used to receive a response message from the queuing system; Every consumer connects to
a unique direct-based exchange via a unique exclusive queue; its life-cycle is limited to the message
delivery; the exchange and queue identifiers are determined by a *UUID generator*, and are marshaled in
the message sent by the Topic Publisher (only rpc.call operations).
In order to capture reply message, I have tried to connect to a direct exchange with corresponding msg_id or request_id. I am not sure what would be correct exchange id for capturing reply of a specific rpc.call.
Any idea what would be the exchange id what I may use to capture reply from a rpc.call message ? What is the UUID generator as specified in the excerpt I attached ?
I don't know the details of the OpenStack implementation, but when doing RPC over Messaging Systems, usually messages carry a correlation_id identifier that should be used to track requests.
See: http://www.rabbitmq.com/tutorials/tutorial-six-python.html
In ActiveMQ, I was sending a message to a consumer, the consumer then forwards the message to a different process. I wanted to know if there is any way by which the acknowledgment can be send to the broker from the other process??
I tried sending the Message Object using a socket connection to the other process and then calling the acknowledge() method on it, it is not working.
I tried the sending the message to some other class object(in the same JAVA process) and then calling the acknowledge() method, it worked.
I guess it depends on how you are sending the message to the other process...I'd just call acknowledge() in first consumer after the call to deliver it to the other process...that should guarantee that its been delivered (assuming your delivery to the second process is sound)...