Facing a weird issue related to ActiveMQ.
1. Have setup a simple queue for processing the incoming request.
2. Able to send the message successfully to the Queue.
3. When I check the message in the admin portal, it shows under the Enqueued message.
4. But the Consumer never got the message from the Queue.
5. When I submit the second request, the request gets dequeued.
6. The problem is with the previous message being lost and considered by ActiveMQ as dequeued.
Any suggestions on troubleshooting this issue is highly appreciated.
Thanks
Related
In a spring boot app, i use JMS with QPID to receive messages from an Azure ServiceBus Queue.
I create my own connection factory with properties:
SessionsAcknownlegdeMode: CLIENT_ACKNOWlEDGE
RedeliveryPolicy Outcome: REJECTED
MaxRedelivery: 5
I use the annotation #JmsListener
Problem: When I consume the message, we try to send a mail with JavaMail, this normally works but it happened that the smtp server we use was having problem so the org.springframework.mail.MailSendException was thrown.
The message is correctly retried and put in DLQ after max retries but after a few messages in error, my #JmsListener method is not invoked for the following messages, and they are put directly in DLQ. That is not what I want.
I tried to replicate this behavior locally by manually throwing exceptions in the listener for given messages, but the consumer correctly sends bad messages to DLQ and consumes good messages.
Does anyone know what is happening ?
Consider the following sequence diagram which depicts the communication between a FIX initiator and the acceptor. Please note I am refering to FIX.4.4 here.
As you can see the message with sequence number 2 gets lost in transit. The initiator sends another message (with seq. number 3), the acceptor detects that gap and issues a resend request, asking again for message with seq. number 2 and everything that might have followed (7=2|16=0).
A couple of questions that I couldn't get answered by digging through the spec:
What happens if the "Resend Request" gets lost in transit?
What happens if the initiator is not able to resend the requested messages?
What happens if the "Resend Request" gets lost in transit?
The gap will be detected on the subsequent message just as you lined out.
However, the ResendRequest will not actually be resent because the only session-level message that must be resent is the Reject message.
Instead, either a SequenceReset with 123/GapFillFlag=Y (description) will be sent or the message will be skipped with a SequenceReset message with 36/NewSeqNo set to a higher sequence number, effectively skipping the message that will not be resent.
This is stated in the FIX spec in chapter "message recovery" (link)
What happens if the initiator is not able to resend the requested
messages?
As stated above it should either send a GapFill instead, or skip to a higher sequence number.
I'm trying very hard to understand the flow of a web request to a server which has a queue or message broker in the middle, but I can't find information about when and where the reply is given.
Imagine this use case:
Client A:
sends a invoice order request
the invoice is enqueued
the request is processed and dequeued.
at which time the client will receive a response?
right after the message is received by the queue?
right after the message is processed and dequeued? Other?
I'm asking because if the reply only comes after the message being processed the client might wait a long time. Imagine the message takes 3 minutes to process, would the client need to keep requesting the server to see if it is processed? or a connection is maintained using something like long polling?
I'm interested in scenarios using RabbitMq and kafka.
Advantage of having a messaging system is to ensure the frontend webserver and backend processing is decoupled. Best practice is Web server should publish the message and just wait for the messaging system to acknowledge receiving the message.
I have a message a want to dequeue then right after its dequeued I want to queue another message to a different queue. I want to do all this in the same transaction. is this possible with rabbitmq or any other queueing service?
The closest you can get to what you want with RabbitMQ is:
Use acks and publisher confirms
You receive a message and do not ack it.
Send your reply message.
Wait for confirm from the broker.
Once confirm had arrived, ack initial message.
But then, consider this failure situation:
Initial message received
Reply message sent
Your service failed before ACKing initial message
When your service is back, it will receive the initial message again
So you will need to use some deduplication mechanism etc.
I am using org.hornetq.api.core.client
how can I guarantee the message that I am sending actually reached the queue (not the client, just the queue) ?
producer.send("validQueue",clientMessage)
please note that the queue is a valid queue .
this similar question is referring to invalid queue. other ones such as this one is relevant to the delivery to the client .
It really depends on how you are sending.
First question of yours was about
First of all, on JMS you have to way to send to an invalid queue since the producer will validate the queue's existence. On HornetQ core api you send to an address (not to a queue), and you may have an unbound queue. So you have to query if the address has queues or not.
Now, for confirmation the message was received:
Scenario I, persistent messages, non transactionally
Every message is sent blocked. The client will unblock as soon as the server acknowledged receiving the message. This is done automatically.. you don't have to do anything.
Scenario II, non persistent messages, non transactionally
There are no confirmations by default. The message is sent asynchronously. We assume the message is transient and it's not a big deal if you lost it. you can change that by setting block-on-non-persistent-send on the ServerLocator.
Scenario III, transactionally (either persistent or not).
As soon as you call commit the message is on the queues.
Scenario IV, Confirmation send
You set a callback and you get a method call as soon as the server acked it on the queues. Look on the manual for confirmation callback. There's also the same feature on JMS2.