Auditing dead letter queue messages use Apache camel or not - spring

I have been reading on JMS, ActiveMQ and Camel.
From my understanding, if we need to integrate multiple system where integration involves only routing of messages in same format, activeMQ is sufficient else we can opt for camel.
Now incase of message redelivery expiration caused by some exception or transaction rollback, activeMQ sends the failed message to dead letter queue.
We are not using Apache camel as activeMQ is sufficient for our requirements but should I opt for camel if I want to monitor and audit the failed messages or will it add an overhead ?
I have not used camel before so if someone can direct me how to monitor dead letter messages. We are thinking of having dead letter queue for each of our topic or queue and provide audit logs for client.

Depends. What do you want to do with DLQ messages? How many errors do you anticipate?
If the error rate is very low and it's hard to predict what to do with errors, maybe some alert could trigger a human to look at the DLQ message on DLQ to figure out what to do with it. Retry? File a bug report? Call someone?
To monitor DLQs you could use JMX or it's http equivalent, Jolokia, to monitor the queues and send an alert if the queue size is more than zero.
You can of course use Apache Camel to somehow process the dead message. Like send it in an email, save it to an error reporting system or take other action to alert a user, use different logic to process the message or what not. This logic you can write in any framework, not just Apache Camel. But Camel is a decent choice.
Anyhow, there is no silver bullet for DLQ management. You must build a system that (manual or automatic) that fits your needs and limits.

Related

JMS delivery order in EMS or BW

Is there any way you can control the order delivery of messages in a topic in EMS or Tibco (using a JMS Topic Subscriber)? Something like the message selector, but instead of filtering to do ordering.
I would like to use a header like JMSXDeliveryCount, so that new messages will get a higher priority. I know that there's RedeliveryDelay, but that works only for queues, not topics.
Even JMSPriority could be an option if I can set it after getting the message with a topic subscriber. Can I do that? Maybe with a Java Code activity?
The broker will deliver messages in order as it receives them, but re-ordering messages is a distributed computing / EIP problem (see sequencer). The issue is the broker does't know how many messages are coming or how long to keep the window open for re-ordering messages. This activity is best done outside the broker in your application where that information is understood.
EIP frameworks and ESB's have done a nice job of standardizing a handler for this type of workflow.
ref: EIP Sequencer http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageSequence.html
JMSPriority is indeed an option, but it cannot be set on an already received message. The solution is to confirm the message and republished it with a different priority.

How to go about messages in Dead Letter Queue

We are using WebLogic 10.3.6.0 and IBM MQ 7.5.
Application design is to send messages to a dead letter queue (in WebLogic) on re-delivery. The re-delivery happens as the first delivery has failed due to some network issue or database data source failure.
My Client wants a way to browse the messages in the dead letter queue from the application GUI and pull them for processing when the network issue or data source issue has been resolved.
What is the best way to go about this?
I cam across QueueBrowser coupled with activemq or some other implementation. Is QueueBrowser possible with WebLogic? Please suggest on best ways to achieve this requirement.
Kindly pardon if my question is too naive. I am only a PL/SQL programmer.
Valerie is referring to the SYSTEM DLQ and application should never ever write to it. Application's should have there own DLQ.
i.e. If your application queue is called 'TEST.Q1' then your application DLQ should be called 'TEST.Q1.DLQ'.
There is a whole long list of MQ tools here to view messages and manage your MQ environment.
Is the application actually designed to write to the DLQ? If so, that is a very poor design. The DLQ is for the queue manager and MQ software to place messages which can not be delivered. The application should not be writing to the DLQ.
As for how to view messages on DLQ, that can be done with the MQ Explorer GUI. Or to write a script, use the DLQ handler (runmqdlq) with a rules table for processing messages.

Blocking competing clients to take message from ActiveMQ

We have a JMS queue and multiple competing clients are reading from this queue.
Once the message is taken and successfully processed, we want to send the acknowledge to delete ( i.e. CLIENT ACKNOWLEDGE )
However, we want to make sure that if one client has picked the message another client should not take it from the queue.
Does activeMQ provide this feature out of the box using some configuration ?
Moreover:
If the message processing failed after picking the message, so it could not be acknowledged back, in this scenario we should like other client thread to pickup the message. Is it possible out of the box with configuration , may be specifying timeout values ?
Regards,
JE
You need to take some time to understand the difference between a Topic and a Qeueue in order to understand why the first question is not an issue.
For the second question it depends a bit on the ACK mode you are using and how you are processing messages sync or async. Normally for processing where you want to control redeliveries you would do the work inside of a transaction and if the processing fails the message would be redelivered when the TX is rolled back. ActiveMQ supports redelivery policies both client side and broker side that control how many time a message will be redelivered before sent to a DLQ.

JMS p2p failover pattern in order to guarantee delivery

Im a web developer ended up in some j2ee development (newbie). I sincerely need this theory confirmed.
I been given the privilege to deliver a message from our system (producer) to the SOA Enterprice service bus (consumer) when the user hits the save button. The information can not be missed or not delivered and the delivery order must be kept.
Environment:
Jboss eap 5.1 as the producer.
JNDI server is the ESB (maybe standard).
Jboss ESB as the consumer.
My weapon of choice is JMS, p2p, due to the asynchronous nature.
When the producer is abut to send the message some problems can occur:
ESB is down causing JNDI exception
Queue manager is for some reason not awake or wrongly configured. This should cause some JMS exception.
Network hickup, causing a JMS error.
So Im looking for some failover pattern. Here is my suggestion:
Add a internal JMS queue to which the message is initially added.
Add a MDB that listen to the internal queue and tries to send it to the target queue (ESB).
If failing in any way log fatal and send email to cool support people.
This should generate a reliable pattern where a message remains on the internal que until processed by the MDB.
Please advice.
Best Regards
ds
Well a 'temporary' queue is not a totally bad idea, but during the time from moving data from one queue to putting it on another you'll have a potential window of risk. Even though that window is close to nothing, what would happen if you got some failure right there and then? -You'd have to put the message back on the queue (and there you'd get into the problem with getting it in the correct order - nasty stuff!) or hold on to it in some way until you put it the other queue (which in turn can be cumbersome if you'd e g get into some failure-situaton.
A more stable solution would be to put data in a db with a queue-order column. You can then select your data in the correct order, send it to the new queue, and finally flag it as 'done' or something or even (better?) remove the data in the db.

Using Activemq, spring for processed messages

I want to make an application where:
Users will send a message to queue
Listener will listen messages of
queue After processing of message in
listener, listener
will create a new response message
and send it to another success or
failure queue.
Questions:
Should I use activemq as storage of processed messages?
Will I be able to retrieve all messages of one queue without listing to them?
Do we have any other solution for keeping all processed messages? I want to make a report of all processed messages present in success and failure queue.
You can find a minimalistic sample here and here for using ActiveMQ with Spring. About persistence options, read ActiveMQ docs. Also you might want to check out these slides, to get a general overview on Spring JMS with ActiveMQ.
ActiveMQ is not a storage facility, it is a message-passing facility.
If you want to store the messages after processing them then use a database. For example, create a table that has a status flag for success or failure, then for reporting query that table.

Resources