0
votes

I am working on IIB 10 toolkit.I have to stop a message flow which listens to a queue.How to inhibit the input queue of that messageflow from another service using esql commands?I know the mqsc commands to alter the queues, but don't know to do the same from esql code.Please help.

Hi, please find the code below: I got this from a forum and I still have doubts on this code like how to specify the q manager to which the queue is associated with.

    CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
    CREATE NEXTSIBLING OF OutputRoot.MQMD DOMAIN 'MQADMIN' NAME 'MQPCF';

    CREATE FIELD OutputRoot.MQPCF;
    DECLARE refRequest REFERENCE TO OutputRoot.MQPCF;
    SET refRequest.Command = MQCMD_CHANGE_Q;
    /* First parameter: Queue Name. */
    SET refRequest.Parameter[1] = MQCA_Q_NAME;

    SET refRequest.Parameter[1].* = 'TEST.IN';
    /* Second parameter: Queue Type. */
    SET refRequest.Parameter[2] = MQIA_Q_TYPE;
    SET refRequest.Parameter[2].* = MQQT_LOCAL ;

    /* Third parameter: Allow/Inhibit GET.*/

    SET refRequest.Parameter[3] = MQIA_INHIBIT_GET;
    SET refRequest.Parameter[3].* = MQQA_GET_INHIBITED;
    SET OutputRoot.BLOB.BLOB = asbitstream(OutputRoot.MQPCF);

    SET OutputRoot.MQPCF = null;
    SET OutputRoot.MQMD.Format = MQFMT_ADMIN;                                              
2
I don't think it is possible to do this in ESQL. Do you really need to inhibit get on the queue? If not, you can stop the message flow with the class MessageFlowProxy of the Integration API from a Java compute node. But be careful: The handling of the proxy classes inside IIB is tricky to get it running without resource leaks, see BrokerFacade class. - Daniel Steinmann
I read from some forums like we can use PCF commands to disable the queue.I tried some code which I found online but not working. - Lyanna_Learner
Why not post your code. simpler MQSET call could also be used as alternative to PCF. - JoshMc
Hi, added the code snippet in the issue description. - Lyanna_Learner
The code posted appears to build the PCF message, you would just send it to the S.A.C.Q of the queue manger with the queue you want to disable get for. You would need proper permission to do this. - JoshMc

2 Answers

0
votes

You don't seem to understand how IIB works. You specify the QM by how you set up your message flow output node.

You use ESQL only to build the PCF message. You should look into the MQCFH parser.

Then you send that message in your message flow via an MQ Output node pointed to the QM and the SYSTEM.ADMIN.COMMAND.QUEUE queue there.

Your code seems wrong only as it converts to BLOB, which is not necessary, and it doesn't set some header values. Check this link for more detailed examples: https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ac16915_.html

I believe this code should work for building the command message, but I cannot try it now:

CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
CREATE NEXTSIBLING OF OutputRoot.MQMD DOMAIN 'MQADMIN'
NAME 'MQPCF';
DECLARE refRequest REFERENCE TO OutputRoot.MQPCF;

SET OutputRoot.MQMD.MsgType = MQMT_REQUEST;
SET OutputRoot.MQMD.ReplyToQ = 'REPLYQ';

SET refRequest.Type = MQCFT_COMMAND;
SET refRequest.StrucLength = MQCFH_STRUC_LENGTH;
SET refRequest.Version = MQCFH_CURRENT_VERSION;
SET refRequest.Command = MQCMD_CHANGE_Q;
SET refRequest.MsgSeqNumber = 1;
SET refRequest.Control = MQCFC_LAST;

SET refRequest.Parameter[1] = MQCA_Q_NAME;
SET refRequest.Parameter[1].* = ‘QYOUWANTTOINHIBIT’;
SET refRequest.Parameter[2] = MQIA_Q_TYPE;
SET refRequest.Parameter[2].* = MQQT_LOCAL;
SET refRequest.Parameter[3] = MQIA_INHIBIT_GET;
SET refRequest.Parameter[3].* = MQQA_GET_INHIBITED;

RETURN TRUE;
3
votes

Your only choice is to create an external program to either issue an MQ PCF command or use the MQSET API call. Either one is reasonably straight forward.

You can use the MQSET in C, COBOL, C#, Java, etc.

In Java, you would do:

MQQueue queue = qMgr.accessQueue("TEST.Q1", CMQC.MQOO_SET + CMQC.MQOO_FAIL_IF_QUIESCING);
queue.setInhibitGet(CMQC.MQQA_GET_INHIBITED);

You can check out this blog posting for a complete Java program that will issue the MQSET API call against the queue's get & put attributes with either inhibit or allow.