I have deployed my application on WebSphere and it is up and running and so are the queues associated with the application.
When I put messages on the queue I do not see any processing in SystemOut.log file of the app server. This queue is supposed to process the message and then forward it to another queue.
Please tell me which log file to check the processing of the message being done my application.
A really simple verification would be to inhibit the consumption of the messages.
Then your produced messages will stay in the queue.
Are you using the SIB or WebSphere MQ ?
As far as I know, the SIB does not log anything about message consumption by itself. However, you could use a logging framework such as Commons-Logging, Log4J, ... to add some logging details.
Related
We are migrating applications from WebSphere Application Server Full profile (WAS) to Open liberty (OL)
One of the pattern we have is to consume a Queue in "strict FIFO order" for some JMS Queue. Many occurrences of the application are running concurrently ("cluster members" in WAS, "pods" in kubernetes/statefulset/docker for OL).
To implement FIFO, one and only one "JMS Activation" process/MDB can consume the Queue and if an exception occurs, stop the listener (JMS Activation)
In WAS, we can do this by
setting"WAS_EndpointInitialState"to"ACTIVE"on the JMS Activation for one server and"INACTIVE"for the others
set"Maximum server sessions"to 1 on the JMS Activation
check"Stop endpoint if message delivery fails"
monitor the logs to see if the activations stopped
In OL we can in"server.xml":
set"autoStart="true"on the"jmsActivationSpec" stanza for one of the process and "false"for the others
set"maxEndpoints="1"on the"jmsActivationSpec"
But how to make the activation stop in case of the application throw an exception in the"onMessage"method in the MDB?
[EDIT 1 After #JoshMc comment]
Currently, the message is moved to the DLQ and the activation never seem to stop, so FIFO is broken as the next message in the Queue is consumed...
Currently, when the "onMessage()"method throws an exception, the message is put back on the Queue, and immediately reprocessed, endlessly
The setting in"server.xml" to connect to IBM MQ from OL is done as decribed here
[EDIT 2]
This feature (stop the activation in case of failure) is implemented in IBM MQ rar v9.1.1 and WebSphere Liberty 18.0.0.4 by setting the "maxSequentialDeliveryFailures" property on the activation spec in this RFE. It does not work on Open Liberty v19.0.0.2 and IBM MQ rar v9.1.1. The rar specifically targets WebSphere Liberty to apply the property as cofirmed after activating traces on the connector:
March 7, 2019 1:17:38 EST PM[Default Executor-thread-7] ResourceAdapterImpl
WMQ messaging : '9.1.1.0-p911-L181120.1'.
MQJCA5003: 'maxSequentialFailureCount' cannot be set outside Websphere Liberty Profile
So the question is still there: How to make the activation stop in case of the"onMessage"method in the MDB fails to consume the message? Open a RFE to IBM MQ asking to port the feature to Open Liberty?
So using JMS and ActiveMQ, I can be sure that my message sent from my Spring Boot application using JmsTemplate will reach it's destination application even if that destination application is down at the time I send the message to ActiveMQ. As when the destination application starts up, it grabs the message from the queue. Great!
However.
What happens if my Spring Boot application tries to send a JMS message to a queue on the ActiveMQ server, but the ActiveMQ server is down at that point or the network is down and I get a connection refused exception?
What is the recommended way to make sure my application keeps trying to re-sends the message to ActiveMQ until it is successful? Is this something I have to develop into my application myself? Are there any nifty Spring tools or annotations which do this for me? Any advice on best practice or how I should be handling this scenario?
You can try Spring-Retry. Has lots of fine grain controls for it:
http://www.baeldung.com/spring-retry
https://github.com/spring-projects/spring-retry
If it is critical that you don't lose this message, you will want to save it to some alternative persistent store (e.g. filesystem, local mq server) along with whatever retry code you come up with. But for those occasional network glitches or a very temporary mq shutdown/restart, Spring-Retry alone should do the trick.
Couple of approaches I can think of
1. You can set up another ActiveMq as fallback. In your code you don't have to do anything, just change your broker url from
activemq.broker.url=tcp://amq01.blah.blah.com:61616
to
activemq.broker.url=failover:(tcp://amq01.blah.blah.com:61616,tcp://amq02.blah.blah.com:61616)?randomize=false
The rest is automatically taken care of. i.e. when one of them is down, the messages are sent to other.
Another approach is to send to a internal queue (like seda, direct) when activemq is down and read from there.
Adding failover to the url is one appropriate way.
And another reasonable way is to making sure activemq always online , as activemq has the master-slave mode(http://activemq.apache.org/masterslave.html) to get high availability.
Application Data Flow:
JSon Messages--> Active MQ --> Spring XD-- Business Login(Transform JSon to Java Object)--> Save Data to Target DB--> DB.
Question:
Sprin-Xd is running in cluster mode, configured with Radis.
Spring XD picks up the message from the Active message queue(AMQ). So message is no longer in AMQ. Now while one of the containers where this message is being processed with some business logic suddenly goes down. In this scenarios-
Will Spring-XD framework automatically re-process that particular message ? what's mechanism behind that?
Thanks,
Abhi
Not with a Redis transport; Redis has no infrastructure to support such a requirement ("transactional" reads). You would need to use a rabbit or kafka transport.
EDIT:
See Application Configuration (scroll down to RabbitMQ) and Message Bus Configuration.
Specifically, the default ackMode is AUTO which means messages are acknowledged on success.
My application puts in messages in a JMS queue. A bean that implements MDB and MessageListener pops messages from this queue. All this happens on a single JVM .
What I want to do is: I want the MDB and the other instances that it would get from pool for concurrent processing to run on a different JVM. How can I do it? The application server that I am using is JBOSS 4.0.5.GA.
Thanks in advance.
If I understand correctly, you want to split your application into "producer" part (stays in the same server) and "consumer" part (MDBs moved to another server), and still be able to communicate.
In this case you need to configure the ConnectionFactory in the "consumer" server to plug in to the "producer" server's MQ. Have you read this part of JBoss 4.x docs?
I use JMS (Java Message Service API) in my java application to work with queues/topics residing on websphere MQ. I am looking for a tool/support pac which can show me all MQ Messages being called e.g. when I do queueConnectionFactory.createConnection(), it would have resulted into MQCONN/MQCONNX call, so I need to see what excatly is being passed. So basically during my entire JMS based interaction, I want to see all MQ messages which are being passed to. Is it possible?
if you are using websphere, you can turn on tracing by going to WAS console and tracing service to enable jms logging.
Trace tells you what APIs are being called. To a good extent trace helps. But beyond that call IBM help.
If you are using JMS MQ client mode connection it is possible to run send/receive exits on the MQ SVRCONN channel to log the client MQI and message flows. The free IBM SupportPac MA0Z has this capability. This technique is not possible with a binding mode connection because there is no MQ channel involved.