IBM MQ- Create a new local definition of remote queue - ibm-mq

Current setup is QM1 (queue manager 1) is having local definition Q1 (mq 1). On QM2, Q1 is configured as remote queue. This configuration works fine. That means any app connecting to QM2 can use name Q1 and those messages gets forwarded to QM1 through distributed Mq setup(channels, transmit queues).
I want to know if I create new Q1 as local queue on QM2 , will mqput calls forward messages to both Queues?

You cannot issue 1 MQPUT and have the message go to more than 1 queue unless you have configured a distribution list or configured the queue to be under Pub/Sub but not all fields of the MQMD are copied.
If you want to replicate messages (for a backup or SLA mechanism) including the MQMD fields then you need to look at a product like MQ Message Replication.

Related

Is it possible to setup an IBM MQ reciever channel to recieve messages from two different queue managers

Is it possible to setup an IBM MQ receiver channel to receive messages from two different queue managers with the sender channels named identically. I am looking at a situation where a client wishes to have two queue managers (A and B) able to send messages to the same destination queue manager (C). A and B are setup up in an active / passive cluster setup without shared storage.
It is not only possible to set up IBM MQ Receiver channels to receive messages from two different queue managers, it is recommended to do so.
For example, on QM3 (the receiving queue manager) make the following definition:
DEFINE CHANNEL(TO.QM3) CHLTYPE(RCVR) TRPTYPE(TCP)
Then on both QM1 and QM2 make the following definitions:
DEFINE CHANNEL(TO.QM3) CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('qm3-host-name(qm3-port)') XMITQ(QM3)
DEFINE QLOCAL(QM3) USAGE(XMITQ)
Doing this will NOT cause sequence number issues as the state for each running receiver channel instance is keyed off the channel name plus the partner queue manager name, so there will be state for:-
Channel:TO.QM3 from Partner QMgr QM1
Channel:TO.QM3 from Partner QMgr QM2
Both channel instances can be running at the same time quite happily without interfering with each other.
You can see this state by issuing the following command on the receiving queue manager, QM3:-
DISPLAY CHSTATUS(TO.QM3)

Routing messages between queue managers using websphere message broker

How can I use WebSphere Message broker instance to route messages between queues residing in two queue managers. The message broker instance can only be associated with one queue manager during creation time. So I create an MQInputNode and put messages to the specific source queue. My concern is to route this message to second queue residing in another queue manager using the same broker instance. How? I am using WebSphere Message Broker version 8.0.0.8. Not yet into IIB.
Below is a simple and efficient way of doing it.
Suppose, your broker is on QM1. You have a local queue in QM2 named LQ_QM2.
And you want the messages to go to LQ_QM2. Follow below steps:
At QM1, create a local queue of usage 'Transmission'. Let us name this transmission queue as "QM2".
At QM1, create a sender channel named "QM1.QM2" with proper connection name (Contains host(port) of target queue manager, for eg
10.1.5.2(1144)) and set transmission queue as QM2 (The one we created in step 1).
Create a receiver channel at QM2 named "QM1.QM2).
Now create a remote queue definition at QM1. Let's name it as RQ_LQ_QM2. Set remote queue property as LQ_QM2 and transmission queue
as QM2 and remote queue manager as QM2.
The messages which you want to send to the queue LQ_QM2 can now be written by the broker to RQ_LQ_QM2 in QM1 itself.
If you can't do the above MQ stuff and must use only Message broker capability then the way of doing it in WMB 8 would be to use Java and write an MQ client code using the MQ API libraries. You will then establish remote connection with the remote queue manager using SVRCONN channel and put messages on the remote queue manager's queue.

WebSphere Remote MQ Clustering

I have two machines - Machine 1 and Machine 2. Machine 1 has one queue manager QM1 and a broker(integration server) BR1 and Machine 2 has one queue manager QM2 and a broker(integration server) BR2 . I want to make a cluster between QM1 AND QM2. I had created a remote cluster queue named INVENTQ in QM2 .The problem is that I am able to successfully post any message on any queue manager and I am able to see the corresponding message on INVENTQ in QM2 . But I want the architecture to be in such a way that I am able to receive the message from the queue from any of the queue managers in addition to the queue manager in which the queue INVENTQ is created i.e QM2 . Can anybody guide me in this ?
MQ does not have a 'remote get' capability - ie you cannot use local bindings to a queue manager and get a message from another queue manager. If you want to do this, you need to use client bindings to go to the queue manger where the message resides directly.
At MQPUT time, a decision has to be made (on the putting queue manager), where to forward the message to (e.g. which local queue, or which transmission queue to pass it to another queue manager).
In a cluster setup, if you have a queue defined on one queue manager and put it the cluster, anyone from any of the clustered queue managers can put to it as though it was a local queue. However their MQPUTs result in the message arriving (via the cluster channels), onto the one particular instance. Therefore from a different queue manager whilst you can put the message to the queue, you cannot get it.
You could have a queue with the same name defined on multiple queue managers and clustered, as per #JoshMc's suggestion, but this means that at MQPUT time, the message is routed to one, and only one, instance of that queue - if it was routed to the remote queue manager clustered definition you still would not be able to get it from the local queue manager. Imagine you had a cluster of 3 qmgrs. You can create a clustered queue called 'FRED' in 2 of them. All of them can put to FRED - but 2 of them will default to put to their local queue only (unless you set CLWLUSEQ=ANY), the other will (usually) alternate between the 2 remote instances. Each queue will definitely have different messages on.
https://www.ibm.com/developerworks/community/blogs/messaging/entry/Undestanding_on_MQ_Cluster_Work_Load_Management_Algorithm_and_Attributes?lang=en

Difference between Queue Manager and Queue in MQ

Looking at the sample codes it seems I need queue manager and queue name to setup MQ through code. What is difference between those and where I can get those values from? Any suggestion?
MQTopicConnectionFactory cf = new MQTopicConnectionFactory();
// Config
cf.setHostName("localhost");
cf.setPort(1414);
cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
cf.setQueueManager("QM_thinkpad");
cf.setChannel("SYSTEM.DEF.SVRCONN");
MQTopicConnection connection = (MQTopicConnection) cf.createTopicConnection();
MQTopicSession session = (MQTopicSession) connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
MQTopic topic = (MQTopic) session.createTopic("topic://foo");
MQTopicPublisher publisher = (MQTopicPublisher) session.createPublisher(topic);
MQTopicSubscriber subscriber = (MQTopicSubscriber) session.createSubscriber(topic);
You connect to a queue manager which may host many different queues. So yes, an application generally needs access to a queue manager and then specific queues on that queue manager. I suggest you can look at the Stack Overflow info for the websphere-mq tag to help get you started. The names of those objects should be known by your application architect/developer or can be confirmed with the MQ admin.
A Queue is a container for messages. Business applications that are connected to the Queue Manager that hosts the queue can retrieve messages from the queue or can put messages on the queue. We have difference types of Queues as follows:
Local Queue: A local queue is a definition of both a queue and the set of messages that are associated with the queue. The queue manager that hosts the queue receives messages in its local queues
Remote Queue: Remote queue definitions are definitions on the local Queue Manager of queues that belong to another queue manager. To send a message to a queue on a remote queue manager, the sender queue manager must have a remote definition of the target queue.
Alias Queue: Alias queues are not actually queues; they are additional definitions of existing queues. You create alias queue definitions that refer to actual local queues but you can name the alias queue definition differently from the local queue (the base queue). This means that you can change the queues that an application uses without needing to change the application; you just create an alias queue definition that points to the new local queue.
Source
Before going to connect Queue, we must start a queue manager.The queue manager has a name, and applications can connect to it using this name. The queue manager owns and manages the set of resources that are used by WebSphere MQ.
Page sets that hold the WebSphere MQ object definitions and message data
Logs that are used to recover messages and objects in the event of queue manager failure
Processor storage
Connections through which different application environments (CICS®, IMS™, and Batch) can access the WebSphere MQ API
The WebSphere MQ channel initiator, which allows communication between WebSphere MQ on your z/OS system and other systems
Source

messages from a remote queue to another remote queue

We have 2 MQ Queue Managers, and one WAS server. We need to send message from QM01 to QM02 and then from QM02 to WAS server.
For doing this we have built a sender channel between QM01 and QM02, message is placed over a remote queue which has a definition of another remote queue for the WAS Service Integration Bus queue.
Is there any harm in sending message as following;
Remote Queue on QM01 ==> Remote Queue on QM02 ==> Queue on SI
Bus on WAS
Yes, this is a perfectly valid method of hopping messages from one queue manager to another, especially if the queue managers are not clustered. There is no harm to the message or the environment with this approach, though it does has a little more administrative overhead as opposed to a cluster-based solution.

Resources