|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
create and start instance |
« View previous topic :: View next topic » |
Author |
Message
|
karthik |
Posted: Thu Oct 30, 2003 6:18 am Post subject: create and start instance |
|
|
 Centurion
Joined: 17 Oct 2003 Posts: 114
|
After executing the program create and start instance i donot see any template being created in my FAT client.
I am copying the code i have ..
Please help me find out what the bug is..
And i am also not using any reply Q, reply QMGR
import java.io.*;
import java.util.*;
import com.ibm.mq.*;
public class dup2 {
private static final String INAMETAG = "<ProcInstName>";
private static final String STATETAG = "<ProcInstState>";
private static final String TIMETAG = "<LastStateChangeTime>";
private static final String ENDTAG = "</";
/** Creates a new instance of ProcessTemplateCreateAndStartInstance */
public dup2() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
String WorkFlowQMGR = null;
String UPESQueue = null;
String ReplyQMGR = null;
String ReplyQueue = null;
boolean responseRequired = false;
if ( args.length != 4 &&
args.length != 2) {
System.out.println("Paramters are: Queue, QueueManager, ReplyQMGR, ReplyQueue");
System.out.println("Note that ReplyQMGR and ReplyQueue are OPTIONAL " +
"And if one is specified BOTH must be specified");
System.exit(-1);
}
UPESQueue = args[0];
WorkFlowQMGR = args[1];
if (args.length > 2) {
responseRequired = true;
ReplyQMGR = args[2];
ReplyQueue = args[3];
}
System.out.println("WorkFlowQMGR: " + WorkFlowQMGR);
System.out.println("UPESQueue: " + UPESQueue);
if (responseRequired) {
System.out.println("Response is required. Qmgr is " + ReplyQMGR);
System.out.println(" Queue is " + ReplyQueue);
}
MQQueueManager qmgr = new MQQueueManager(WorkFlowQMGR ) ;
System.out.println("Connected to QMGR " + WorkFlowQMGR);
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING |
MQC.MQOO_SET_IDENTITY_CONTEXT;
MQQueue queue = qmgr.accessQueue(UPESQueue, openOptions,
null, null, "ADMIN");
String DEFAULT_MQUSERID = "ADMIN";
MQMessage inMsg = new MQMessage();
String MessageInXMLFmt;
inMsg.userId = DEFAULT_MQUSERID;
if (responseRequired) {
inMsg.replyToQueueManagerName = ReplyQMGR;
inMsg.replyToQueueName = ReplyQueue;
}
MessageInXMLFmt = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + "<!-- This document is to create and start a process template -->" + "\n";
MessageInXMLFmt = MessageInXMLFmt + "<WfMessage>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <WfMessageHeader>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ResponseRequired>Yes</ResponseRequired>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <UserContext>I want this data back</UserContext>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </WfMessageHeader>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcessTemplateCreateAndStartInstance>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcTemplName>PT1</ProcTemplName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcInstName>PI</ProcInstName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <KeepName>false</KeepName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcInstInputData>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <PersonInfo>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <CustomerLastName>Sreenivas</CustomerLastName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <CustomerNumber>123</CustomerNumber>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </PersonInfo>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <PartsInfo>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <PartNumber>600</PartNumber>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <PartOrderQty>2</PartOrderQty>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <PartName>ThinkPad</PartName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </PartsInfo>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </ProcInstInputData>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </ProcessTemplateCreateAndStartInstance>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + "</WfMessage>" + "\n";
inMsg.writeString(MessageInXMLFmt);
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_SET_IDENTITY_CONTEXT;
queue.put(inMsg, pmo);
System.out.println("Start message sent");
qmgr.disconnect() ;
if (responseRequired) {
MQQueueManager replyQM = new MQQueueManager(ReplyQMGR);
System.out.println("ReplyQMGR accessed");
int ReplyOpenOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE ;
MQQueue replyQueue = replyQM.accessQueue(ReplyQueue,
ReplyOpenOptions, null, null, null);
System.out.println("ReplyQueue accessed");
MQMessage currentMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions( );
gmo.options = MQC.MQGMO_WAIT;
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
gmo.waitInterval = -1;
replyQueue.get( currentMessage, gmo );
byte buffer[] = new byte[ currentMessage.getDataLength() ];
currentMessage.readFully( buffer, 0, currentMessage.getDataLength() );
String curMsg = new String(buffer);
if ( curMsg.indexOf("<Exception>") != -1 )
System.out.println("An Error has occurred during Process Start\n" +
curMsg);
else {
int inamePos = curMsg.indexOf(INAMETAG) + INAMETAG.length() ;
int statePos = curMsg.indexOf(STATETAG) + STATETAG.length();
int timePos = curMsg.indexOf(TIMETAG) + TIMETAG.length();
String PIName = new String( curMsg.substring( inamePos ,
curMsg.indexOf(ENDTAG,inamePos) ) );
String PIState = new String( curMsg.substring( statePos,
curMsg.indexOf(ENDTAG,statePos) ) );
String PITime = new String( curMsg.substring( timePos,
curMsg.indexOf(ENDTAG,timePos) ) );
System.out.println("Instance '" + PIName +
"' is in the " + PIState + " state as of " + PITime);
}
replyQM.disconnect();
}
}
catch(MQException ex){
System.out.println("MQ Error - Reason code :" + ex.reasonCode);
}
catch (Exception e){
System.out.println("Error : " + e);
}
} // end main
} // end CLASS
Thanks
Karthik |
|
Back to top |
|
 |
vennela |
Posted: Thu Oct 30, 2003 6:42 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
This is a pretty standard code and I haven't looked at the entire code except the XML message that you are trying to PUT to Workflow EXEXMLINPUTQ.
1. Is there a process with the name PT1.
2. Is the InputDatastructure part of the XML formed right? You should double check the parent child nest there.
3. If you have supplied a ReplyToQ, post what the message is in the ReplyToQ. But to do this, you have to include a print statement.
Original code snippet
Code: |
currentMessage.readFully( buffer, 0, currentMessage.getDataLength() );
String curMsg = new String(buffer);
if ( curMsg.indexOf("<Exception>") != -1 )
|
Change it to
Code: |
currentMessage.readFully( buffer, 0, currentMessage.getDataLength() );
String curMsg = new String(buffer);
System.out.println(curMsg);
if ( curMsg.indexOf("<Exception>") != -1 )
|
|
|
Back to top |
|
 |
karthik |
Posted: Thu Oct 30, 2003 6:56 am Post subject: |
|
|
 Centurion
Joined: 17 Oct 2003 Posts: 114
|
Venny
Thanks for the reply. I changed PT1 to the real process name Order, but it still did not work.
I guess i am in confused state.
What should be the output of this program when i run the program and open the client.
Thanks in advance
karthik |
|
Back to top |
|
 |
vennela |
Posted: Thu Oct 30, 2003 7:15 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
A new process Instance should be created and it should be running. If you are using fat client and if you have lists like ProcessTeplate List, ProcessInstance List, WorkLists. If you click on the ProcessInstance List, you should see a proess instance running.
You can also run the admin utility fmcautil and keep it running. Now if you send the XML message to workflow, if there is an error, it will be spit the error in the admin utility window. If you can figure out what it means post it here. If nothing is shown there after the message is PUT, then your process should start fine. |
|
Back to top |
|
 |
karthik |
Posted: Thu Oct 30, 2003 7:56 am Post subject: |
|
|
 Centurion
Joined: 17 Oct 2003 Posts: 114
|
sorry for the late reply..
The error was
10/30/2003 9:53:29 AM FMCSYS: FMC00118E Object does not exist
Thanks |
|
Back to top |
|
 |
vennela |
Posted: Thu Oct 30, 2003 8:21 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Have you imported the process "Order" into runtime. Is the process showing up in the ProcessTemplate List? I believe it is case sensitive. |
|
Back to top |
|
 |
karthik |
Posted: Thu Oct 30, 2003 8:42 am Post subject: Thanks |
|
|
 Centurion
Joined: 17 Oct 2003 Posts: 114
|
thanks Venny
I got it working . I guess i did not import into runtime .
I was under the impression that i did.
thanks very much
karthik |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|