java - MQ Channel restart from code giving error -


i have written java code start , stop mq channel. have created server-connection channel on mq testing code. while executing java code, both start , stop of channel gives errors.

stop channel gives below error:

about stop channel mqje001: completion code 2, reason 2202 

start channel gives following error:

com.ibm.mq.mqexception: mqje001: mqexception occurred: completion code 2, reason 2009 mqje016: mq queue manager closed channel during connect closure reason = 2009 

code:

package com.asm.mqlistenerchannelrestart;  import com.ibm.mq.pcf.*; import com.ibm.mq.*; import com.ibm.mq.pcf.cmqcfc;   public class mqlistenerchannelrestart implements cmqcfc  {      public void startchannel(pcfagent pcfagent){         pcfparameter [] parameters = new pcfparameter [] {                 new mqcfst (mqcach_channel_name, "testchanne"),                 new mqcfst(mqcach_user_id,"user"),                 new mqcfst(mqcach_password,"password")              };           try {              system.out.println("about start channel");             mqmessage [] pcfresponses = pcfagent.send (mqcmd_start_channel,                                                    parameters);              mqcfh cfh = new mqcfh(pcfresponses[0]);             system.out.println("parameter count="+cfh.parametercount);             system.out.println("reason = "+cfh.reason);             system.out.println(cfh.tostring());              pcfresponses = pcfagent.send(mqcmd_inquire_channel_status, parameters);             cfh = new mqcfh(pcfresponses[0]);             system.out.println("channel status ==="+cfh.tostring());         } catch (exception e) {           e.printstacktrace();         }     }      public void stopchannel(pcfagent pcfagent){         pcfparameter [] parameters = new pcfparameter [] {                 new mqcfst (mqcach_channel_name, "testchanne"),                 new mqcfin (mqiacf_quiesce, mqqo_no )                };           try {              system.out.println("about stop channel");             mqmessage [] pcfresponses = pcfagent.send (mqcmd_stop_channel,                                                    parameters);              mqcfh cfh = new mqcfh(pcfresponses[0]);             system.out.println("parameter count="+cfh.parametercount);             system.out.println("reason = "+cfh.reason);             system.out.println(cfh.tostring());              pcfresponses = pcfagent.send(mqcmd_inquire_channel_status, parameters);             cfh = new mqcfh(pcfresponses[0]);             system.out.println("channel status ==="+cfh.tostring());         } catch (exception e) {           e.printstacktrace();         }     }      /**      * @param args      */     public static void main(string[] args) {         // todo auto-generated method stub          pcfagent pcfagent = null;           mqlistenerchannelrestart mqlistenerchannelrestart = new mqlistenerchannelrestart();         mqlistenerchannelrestart.stopchannel(pcfagent);         mqlistenerchannelrestart.startchannel(pcfagent);     }  } 

can please me resolve this?

first of never instantiated pcfagent object.

secondly, send pcf command queue manager via pcfmessageagent. pcfmessageagent extends pcfagent, create object of pcfmessageagent.

thirdly, don't think response coming pcfcommand can held in mqmessage, rather shoud taken in pcfmessage.

what should read more pcf here

also here example of pcf_commonmethods here: ftp:// 119.44.222.58/opt/mqm/samp/pcf/samples/pcf_commonmethods.java

as of code below:

 pcfmessageagent agent = new pcfmessageagent ("localhost", 1414, "client");  pcfparameter [] parameters = new pcfparameter [] {             new mqcfst (mqcach_channel_name, "testchanne"),             new mqcfst(mqcach_user_id,"user"),             new mqcfst(mqcach_password,"password")          };         pcfmessage   request = new pcfmessage (mqcmd_start_channel,parameters);         pcfmessage []   responses = agent.send (request); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -