Need to remove rfh header before sending message to mq - ibm-mq

I'm using JndiDestinationResolver (JNDI-lookup) to resolve destination which i have added on application server.I saw solutions to remove rfh from message is by appending--> queue + "?targetClient=1". I'm passing jndi-name to send(Destination,meassage) and need help to understand how i can set this variable (context file or on app server).
One solution mention- On the administered object there is a property called TARGCLIENT which should be set to 'MQ'.How and where exactly we need to set this on WAS.
I really appreciate any help on this. Thanks!

It is no longer necessary to change the message producer to do this now, there are other options.
So long as your queue manager is at MQ V7.0 or above, you can alter the queue definition on the queue manager as follows, and the RFH2 header will be removed before the message is given to the consumer.
ALTER QLOCAL(q-name) PROPCTL(NONE)

Related

IBM MQ Pubsub message too large

I have a Normal IBM MQ developer edition 924 installed on a ubuntu virtual machine. And have cpp code files for Publisher and Subscriber model. I created a topic and started sending messages on the topic.
The issue happens when I send a larger message on the topic, the error code of 2031(MQRC_MSG_TOO_BIG_FOR_Q_MGR) is outputted. (https://www.ibm.com/docs/en/ibm-mq/9.1?topic=arc-2031-07ef-rc2031-mqrc-msg-too-big-q-mgr)
I changed the maxmsgl value for the Queue manager and the SVR channel as well. I ran the following commands for this:
runmqsc QM1
ALTER QMGR MAXMSGL(104857600)
ALTER CHANNEL(SYSTEM.AUTO.SVRCONN) CHLTYPE(SVRCONN) maxmsgl(104857600)
But still the error persists, could someone reflect on what needs to be done regarding this error code. And also as message segmentation is not allowed on pubsub what is the maximum limit of message size it can handle.
When using a topic for publish/subscribe, the messages sent to subscribers are still put onto a queue for safe storage until they are consumed by the subscribing/getting application. These queues must also have MAXMSGL set appropriately.
If you do not know which queue to adjust, follow these steps:-
Run the subscriber application - assuming that it will wait around for a while
Issue the following MQSC command (e.g. using runmqsc):-
DISPLAY SUB(*) DEST DESTCLAS TOPICSTR DURABLE
The name shown in the DEST field in the output is the queue your subscription is using. If it's name starts with SYSTEM.MANAGED and it also shows DESTCLAS(MANAGED) then your subscription is a managed subscription. You say that your subscription is not managed, but if you don't know which queue is in use by that subscriber then it is most likely that it IS managed, since that means you don't have to worry about the queue.
A managed subscription queue is built from a MODEL queue referenced on the topic. If you are unsure which MODEL queue would be used, issue the following command using the TOPICSTR value from the output of the above command.
DISPLAY TPSTATUS('topic-str-value') MNDURMDL MDURMDL
If the output from the DISPLAY SUB command earlier showed that your subscription was DURABLE(YES) then the MODEL queue in use is the one shown in the field MDURMDL (Managed DURable MoDeL). If it showed DURABLE(NO) then the MODEL queue in use is the one shown in the field MNDURMDL (Managed Non-DURable MoDeL).
Using the name determined in step 4 if it is not managed, or in step 5 if it is managed, issue the following MQSC command:-
ALTER QLOCAL('q-name-from-step-4') MAXMSGL(104857600)
or
ALTER QMODEL('q-name-from-step-5') MAXMSGL(104857600)
Now re-make your subscription (so that it deletes the previous temporary queue it created and makes a new one from the model) and re-run your publisher application.

Dead-letter Queue

my question is about WebSphere MQ's Dead-letter.
How I can view on ISPF the queue manager's dead-letter?
Each queue manager has a default dead-letter queue or I need to define it?
Thanks so much!
A queue manager does not have a dead-letter queue by default. You must tell the queue manager where its dead-letter queue is. The CSQINP2 samples (if you use them) define a QLOCAL called ++qmgr++.DEAD.QUEUE - see sample CSQ4INYG. If you use that sample and do the search and replace on the ++qmgr++ text, you may have the queue defined. But, you still need to tell the queue manager to use that queue as its dead-letter queue.
To view whether a queue manager has a dead-letter queue, you need to issue the following command:-
DISPLAY QMGR DEADQ
Alternatively you can view the same information on the MQ ISPF panels by
Chosing option 1. List or Display
For Object type MANAGER
Hit enter, and view the first page of queue manager details. Just below 'Description' and 'Default transmission queue' you will see 'Dead-letter queue'
To alter it, use option 3. from the ISPF panels or issue the following command:-
ALTER QMGR DEADQ(CSQ1.DEAD.QUEUE)
Changing the above queue name to be correct for your queue manager.
You can use any named queue you wish, you do not have to follow the convention used in the CSQ4INYG sample, but I would recommend having a name that indicates the purpose of the queue clearly.

Error while creation of queue in WebSphere MQ for z/OS

The problem is regarding IBM z/OS and WebSphere MQ.
The task at hand is to create(define) a reply queue for WebSphere MQ.
This is the main WebSphere terminal:
IBM Websphere MQ for z/OS - Main Menu1
The reply queue is to be defined with all the properties of another predefined queue named SYSTEM.DEFAULT.LOCAL.QUEUE. It has to be named <userid>.REPLY, where <userid> is my mainframe ID. According to my comprehension, the 2. Define like Action has to be used to define a new object(queue in our case) based on an existing one. The Object type field can have either QUEUE or QLOCAL value.
As it is documented in the IBM-Infocenter, Name should hold the queue on whose attributes the new queue is to be defined; so Name gets SYSTEM.DEFAULT.LOCAL.QUEUE. Disposition is best declared A. Connect name is the name of the queue manager: CSQ1. The Target Queue Manager and Action queue manager is same as the Connect name.
Main Menu with entered fields2
These settings don't work and an error pops up:
--- CSQO014E MQOPEN of SYSTEM.COMMAND.INPUT unsuccessful. Reason code = 2035. ---
Referring to this site, I concluded that the reason for error maybe any of the two possibilities:
Insufficient storage, or
Authorization issues.
I raised these these concerns at the official IBM developer works community, and it was assured that if there were any technical issues they would get back to me. But no reply followed so that made me think if I were somehow at fault. So I tried almost all possible combinations of the available options and values, but every time one or the other error followed.
Your help would be much appreciated, Thank you.
That error message is pretty self explanatory. If you do not know what reason code 2035 (not authorized) is, did you look in the MQ Messages manual?
Are you the MQAdmin or just some user trying to define a queue? Because only the MQAdmin should be defining queues (or any other MQ objects). If you are not the MQAdmin then ask your MQAdmin to define the required queue.

MQ: Same queue name under 2 queue manager

I have two MQ queue manager with same queue names configured. Both are configured to send data to different servers. Currently queue manager(QM1) is stopped(status Ended Immediately) and QM2 is running
Now my program opens the queue and sends data. It doesnot specify queue manager name. When I execute the program, MQ connection request returns error 2059.
My questions are:
What happens when multiple queue managers have same queue name?
How to tackle situation without changing the code?
Please forgive if the description is vague. It would be helpful if anyone provide links so that newbie like me can learn something.
Thanks
It would be helpful if could provide details on your application. Whether it's using server bindings or client mode connection to queue manager. What version of MQ are you using?
The below information is valid for MQ v7.x:
If you are using client mode then you can use multiple CONNNAMEs to connect. If one queue manager is down, your application will connect to next queue manager in CONNAME list. One of the simplest way to do when using client mode connection is to define MQSERVER environment variable and specify multiple CONNNAMEs.
SET MQSERVER=<channel name>/TCP/host1(port1), host2(port2)
For example when both queue managers are on local host:
SET MQSERVER=MYSVRCONCHN/TCP/localhost(1414),localhost(1415)
In server bindings mode if queue manager name is not specified, then application will attempt to connect to the default queue manager. If the default queue manager is down, then 2059 is thrown.
Your explaination doesn't provide clarity about your requirements.
You wrote:
My questions are 1. What happens when multiple queue managers have same queue name.
Nothing. Its a normal scenario. Different queue managers may have queues with same name and it doesn't create any ambiguity. Although, scenario will be a little different when the queue managers are in same cluster and the queue is also a cluster queue. Then everything will depend on requirements and design.
You wrote:
2. How to tackle situation without changing the code
Run the queue manager which is stopped.
You wrote:
Now my program opens the queue and sends data. It doesnot specify
queue manager name.
What application are you using?For a client application, you access a queue using an object of queue manager.
I am asssuming that you are using an application(client) which doesn't take queue manager details from you, only takes queue details. And may be the queue manager is hard coded within the code. And it sends the message first to the queue of Queue manager 1 and then to queue manager 2. But, in your case queue manager 1 is down.
If above is the case, then the application's code needs to be changed. You should have exception handling in such a way that it executes the code for sending the message to the second queue manager even though the first lines of code throws error.

Automatically clear messages from queue in IBM MQ

I was wondering if there is a way for you to configure a queue to automatically clear messages? We are striving to partially implement a component of our architecture and want to be able to send to the queue, but have the queue automatically remove the messages that are being sent so that we don't have to run scripts, etc to perform the clean-up.
So far the only thing I have been able to find is to run CLEAR QLOCAL or set the messages to expire from the publishing application.
For you use case there are a few options in IBM MQ:
Create a QALIAS that points to a TOPIC object which has a topic string with no subscribers, messages put to the QA will just disappear.
Have the sending application set message expiry.
Use the IBM MQ CAPEXPRY feature to administratively force message expiry at the queue level.
Run a script to issue CLEAR QLOCAL against the queue. There can not be open handles on the queue for this to work.
Programmatically issue the equivalent PCF command to CLEAR QLOCAL against the queue. There cannot be open handles on the queue for this to work.
Run the IBM MQ dmpmqmsg utility against the queue to read and discard the messages.

Resources