How to implement FIFO paradigm with Open Liberty and IBM MQ? - jms

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?

Related

IBM Websphere 8.5 - Consume messages from a Local Queue

I have my application running on WAS 8.5 which consumes messages from IBM MQ. However, I want to test some functionality of my application by posting some messages to the MQ. I am trying to consume messages by creating a queue in my local setup & configuring the queue in WAS 8.5.
I have installed IBM MQ Explorer 9 in my system and created a queue manager & a queue as well. Attached below screenshot from MQ Explorer.
I am trying to have the TEST_QM & TEST_Q1 configured in the WAS 8.5 admin console under Queue connection factories.
Queue Manager Configuration in WAS
Host & port configuration in WAS
However, when I try the connection test in WAS, it returns me the below error.
I am a newbie to WAS, MQ & IBM world. Kindly guide as to where am I going wrong & how can my application consume messages from local queue?
Thank you!

IBM WAS autoreconnect to IBM MQ

I have a Java EE aplication on IBM WAS 8.5.5.x which connects to IBM MQ 9.0 with Activation specs.
I'm interested in problem of autoreconnecting from WAS to MQ, if for some reason there was a connection loss (MQ server was shut down).
In IBM WAS admin console I have set Resources -> JMS -> Queue connection factories -> Factory -> Advanced properties -> Client reconnect options -> RECONNECT
I set Client reconnect timeout to 120 seconds.
That worked well (there was a reconnection) until queue manager was ended for a long period of time (about 9 hours).
Am I doing something wrong ? Is there a way to make QCF or Activation Spec auto reconnect if there was a connection loss. Is there a limit on number of reconnetion tries ?
This behavior can be controlled by updating the "Reconnection retry count" and "Reconnection retry interval" properties for "WebSphere MQ messaging provider" JMS provider in WAS console.
Path :Resources > JMS Providers > WebSphere MQ messaging provider (select scope) > Resource adapter properties (under Additional properties) .
Reconnection retry count : The maximum number of attempts made by a WebSphere MQ messaging provider activation specification to reconnect to a WebSphere MQ queue manager if a connection fails.
Reconnection retry interval : The time, in milliseconds, that a WebSphere MQ messaging provider activation specification waits before making another attempt to reconnect to a WebSphere MQ queue manager.
Refer : https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/umj_pjmswmq_raprops.html for more details.

WebSphere MQ integration with WebLogic - issue sending messages to foreign queue

I'm testing a WebLogic MDB (running on my local Windows dev environment - Eclipse/WebLogic 10.3.2) with WebSphere MQ 6.0.1.0 (running on a Linux server). The WebSphere MQ components have been previously configured and I have the correct .bindings file.
I have followed the instructions described here.
I have no problem consuming messages that are placed on the MQ queue. However, when I attempt to configure the MDB to put messages back to the MQ queue I get the following warning upon server start-up:
<Warning> <JMSPool> <BEA-169808> <There was an error while making the initial
connection to the JMS resource named jms/WLSenderQCF from the EJB "TestMDB"
inside application "EJB Test 2EAR". The server will attempt the connection
again later. The error was javax.jms.JMSException: MQJMS1068: failed to obtain
XAResource>
If I place a message on the queue, my MDB consumes the messages, but these exceptions are thrown when the MDB attempts to put the message to the MQ Queue:
javax.jms.JMSException: MQJMS1068: failed to obtain XAResource...
javax.transaction.xa.XAException: client connection not XA enabled...
java.lang.NullPointerException
Anyone run into this and knows what the problem is?
Thanks for any help.
One issue seems to be the version of MQ you're using. It is ancient. IBM took MQ 6 out of support quite a while ago (Sept '12! http://www-01.ibm.com/support/docview.wss?uid=swg21584325).
Things got a lot easier when IBM decided to include the extended transactional client in the product for free: http://www-01.ibm.com/support/docview.wss?uid=swg21584325
So one option might be to upgrade to a version which includes this out of the box:
7.0.1.12+
7.1.0.5+
7.5
8.0
Otherwise... look into the v6 documentation on how to enable the 'extended transactional client' for JMS assuming you paid for it.

IBM Websphere : Queue manager processing

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.

to view all websphere MQ messages in JMS call

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.

Resources