Logging documents to Monitor from Java Code

Hello all,
I have some custom JMS java code (why I need to do this in the first place is another story) which I would like to submit to Monitor for retry. The aim of the exercise is remove ‘bad messages’ from a JMS queue and log them in Monitor so that they can be viewed/retried/deleted. I do not want the JMS queue clogged with bad messages, but i do not want to throw them away either.

The hard part is that I want to do this from java code and I cannot find a WmMonitor flow service which will do this. Some more facts:

  1. I have a broker document type (which will wrap JMS payload) that I can submit to Monitor
  2. I do not want to use TN for this (as per a related thread on this issue) because I want ability to resumit services, documents and process models from a single place.

Anyone know of a way to log things to Monitor programmatically ?

Why can’t you just do the following:

  1. Have a service that retrieves the messages from the JMS queue
  2. This service then passes the message to a Flow service which is setup to log On Errors and Include Pipeline On Errors Only
  3. If the message retrieved from the queue is a “bad message”, then the service should EXIT and signals FAILURE (this should cause your message to get logged to the Monitor along with its error message)
  4. The service that retrieved the message from the JMS queue should not rollback if it gets a bad message error
  • Percio

What you suggest is a good idea and would certainly work. Currently I am publishing documents so I would have to reconsider things to try this.


So, after you read the message from the JMS queue, you publish it to the Broker instead of invoking a service to process it?

That should not be a problem. Assuming you subscribe the message from the Broker via a trigger, you can configure your trigger service to do the auditing that I referred to above. You can even go one step further and implement logic to retry the document if the error is transient (ie. by using pub.flow:throwExceptionForRetry) and not retry it if it’s a “bad message” (ie. by using EXIT $flow and signal FAILURE)

  • Percio