I am new to the IBM MQ and I am doing research for one of the requirement. I have two MQ channels in the queue manager that I will be connecting from JMS client (Standalone Java Application) and I need to configure those in CCDT file.
When primary MQ channel that I am connected to is down, it has to connect to secondary standby MQ channel after waiting for certain amount of time while trying to reconnect to primary MQ channel.
Can I configure that wait time in CCDT file or in JMS client java class?
I have gone through the some of the IBM documentation and I see the setCCDTURL() and setConnectionTimeout() methods for factory object, I am not sure if that fulfills my requirement.
Related
Developed a Spring Boot Application, which comprises of JMS Message Listener which is listening the JMS Queue. Before starting of the Spring Boot Application, the connection usage in the IBM MQ Server is 24. After starting up the Spring boot application, connection size is incremented to 26, that is 2 connection is created. But I was expecting only one connection has to be created in this case. PSB the connection details
DEV.APP.SVRCONN,,127.0.0.1,,,,,,,NONE,IBM MQ Channel,jmslistener-1.0-SNAPSHOT.jar
DEV.APP.SVRCONN,,127.0.0.1,,,,,REQ_QUEUE_A,QUEUE,ACTIVE,IBM MQ Channel,jmslistener-1.0-SNAPSHOT.jar
Seems the first connection is created for connecting to MQ Channel. I wasn't sure, whether this is the expected behaviour. Can anyone help me to understand on the connection creation and usage pattern in IBM MQ?
Each JMS "Connection" and each JMS "Session" correspond to a separate MQ Connection. So a simple JMS listener (usually 1 connection+1 session) is likely to result in 2 MQ connections as you've seen.
We are trying to connect to IBMMQ using CCDT file and JMS configuration.
We are able to connect to it but we have an issue here:
since we are using spring to set connection factory with CCDT file, this is initialized once at the start of the application, but unfortunately it picks only one queue manager at a time,i.e it sends all the messages to same queue manager and it does not load balance.
Though i observed, if i manually set the CCDT file before every request then its able to load balance the Queue Managers, ideally it looks to me Queue Manager is decided whenever i set the URL to CCDT file. which is wrong practice. My expectation was to initialize the connection factory with CCDT file and then this configuration will be able to load balance on its own.
Can you help me this?
This is the expected behavior. MQ does not load balance clients, it connection balances them. The connection is the single most time consuming API call and in the case of a mutually authenticated TLS connection can take seconds to complete. Therefore a good application design will attempt to connect once, then maintain that connection for the duration of the session. The JMS architecture and Spring framework both expect this pattern.
The way that MQ provides load distribution (again, not true balancing, but rather round-robin distribution) is that the client connects a hop away from a clustered destination queue. A message addressed to that clustered destination queue will round-robin among all the instances of that queue.
If it is a request-reply application, the thing listening for requests on these clustered queue instances addresses the reply message using the Reply-To QMgr and Reply-To Queue name from the requesting message. In this scenario the requestors can fail over QMgr to QMgr if they lose their connection. The systems of record listening on the clustered queues generally do not fail over across queue managers in order to ensure all queue instances are served and because of transaction recovery.
Short answer is that CCDT and MQ client in general are not where MQ load distribution occurs. The client should make a connection and hold it as long as possible. Client reconnect and CCDT are for connection balancing only.
Load distribution is a feature of the MQ cluster. It requires multiple instances of a clustered queue and these are normally a network hop away from the client app that puts the message.
I am working on a JMS subscriber application in which i need to connect to a remote SonicMQ queue. When i connect to the queue using broker url,username,password etc, I am getting Queue not found exception but the queue exists on the broker and queue details are available on the .binding file. So can all the queues available in the .binding file be accessed using the non-.binding file method(connecting to broker using broker url and port)? Is there any difference between connecting to the broker using the brokerurl,username,password etc and connecting using .binding file as a provider url?
When we use a client acknowledgement mode in JMS (I am using Websphere MQ and WAS), the MDB sends the acknowledgement to whom (the docs say to the JMS server).
But in this case, the JMS server means what: the WebSphere MQ which actually has all the queues and the messages or the web sphere application server that is connecting to the websphere MQ.
Acknowledgements, no matter the type, are always sent to the JMS server. Message producers and consumers never communicate directly due to the asynchronous nature of JMS.
Are you using connection factories to obtain a connection? If so, look at the broker url configuration in those factories. You should find the connection url points to WSMQ brokers. So, when you get a connection from a connection factory, the client connection goes directly to the JMS server in WSMQ.
I am considering an architecture where I have clients that are intermittently connected to a network. I would like to store messages created on these clients in a JMS queue when the network is not available and have these forwarded to a central message broker when the clients are on the network. (The user has control over the network, e.g. dialing in, so it's not an intermittent connection like with a mobile phone.)
Are there any JMS implementations that provide this feature?
You can embed an activeMQ broker into your application
http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html
Then, I suppose (did not test) that you could use ActiveMQ features which allow you to dispatch messages accross a net of brokers, using the discovery of brokers feature,
http://activemq.apache.org/clustering.html
or simply by adding a queue consumer server side, then dispatching through other brokers through this consumer.
Hope it helps.
The Glassfish Open Message Queue can be embedded (or run stand-alone) in version 4.4 (Support the ability for a broker to run "in process" with any client.). It is very light-weight, and will support other client languages over the STOMP protocol in version 4.4 - besides Java and C. - https://mq.dev.java.net/4.4.html