|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQWorkflow Restart!!Instance Still Alive |
« View previous topic :: View next topic » |
Author |
Message
|
mqmaniac |
Posted: Tue Aug 08, 2006 11:06 am Post subject: MQWorkflow Restart!!Instance Still Alive |
|
|
 Master
Joined: 27 Dec 2005 Posts: 201
|
Hello Everyone..
We have a starnge Issue.
We had too many Instances Alive though would takemuch time terminationg all of them and Restarted the Workflow Server thinking that they would terminate!!!
BUT...The Instaces are still alive after Restarting!!!!!!!!!!
Did we miss anything??
Pls Help!1 |
|
Back to top |
|
 |
jmac |
Posted: Tue Aug 08, 2006 11:17 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Why would you think that stopping workflow would get rid of the running instances? _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
mqmaniac |
Posted: Tue Aug 08, 2006 11:23 am Post subject: |
|
|
 Master
Joined: 27 Dec 2005 Posts: 201
|
Oh..I Missed the Database part of Workflow!!!
Ok..Then How do delete these instances as they do not terminate..even If I do..
Any Idea on Where do these Instantiate as I checked all the queues are empty which instantiate!!! |
|
Back to top |
|
 |
Ratan |
Posted: Tue Aug 08, 2006 12:20 pm Post subject: |
|
|
 Grand Master
Joined: 18 Jul 2002 Posts: 1245
|
All the instance data is maintained in the database. So if you have too many acitivity Instances that you want to terminate, write a program to do it for you. Check the Workflow Java API. _________________ -Ratan |
|
Back to top |
|
 |
mqmaniac |
Posted: Tue Aug 08, 2006 12:59 pm Post subject: |
|
|
 Master
Joined: 27 Dec 2005 Posts: 201
|
Thanks for the reply..I have a Pgm But Confused on what is the AGENT_NAME = agent name;
How to configure..where to look for??
Pls Help??
This is the The Code I am using...
I dont know what the AGENT_NAME is???
Where should i get this Agent Fom!!!!
import com.ibm.workflow.api.*;
import java.util.Vector;
import java.util.Iterator;
import java.lang.*;
public class TerminateProcInst {
public String AGENT_NAME ;
public String CONFIGURATION_ID;
public String GROUP;
public String SYSTEM;
public String USERID;
public String PWD;
public int THREASHOLD = 1000;
public String FILTER_STR = null;
public String SORT_STR = null;
public ExecutionService wfService; //user's WF session (connection)
/**
* WorkflowSample constructor comment.
*/
public TerminateProcInst() { }
public TerminateProcInst(String agentName,
String configID,
String system,
String systemGroup,
String userID,
String password,
String filter,
String sort) {
AGENT_NAME = agentName;//MQW.MQWO2TO1.NUH1MQW1?
CONFIGURATION_ID = configID;
SYSTEM = system;
GROUP = systemGroup;
USERID = userID;
PWD = password;
FILTER_STR = filter;
SORT_STR = sort;
}
public static void main(java.lang.String[] args) {
String aName = "";
String cfgID = "";
String system = "";
String group = "";
String userID = "";
String passwd = "";
String filter = null;
String sort = null;
int i = 0;
String arg;
char flag;
boolean vflag = false;
boolean hadErr = false;
while (i < args.length && args[i].startsWith("-")) {
arg = args[i++];
if (arg.equals("-verbose")) {
System.out.println("verbose mode on");
vflag = true;
}
if (arg.equals("-a")) {
if (i < args.length && !args[i].startsWith("-")) {
aName = args[i++];
} else {
System.err.println("\n-a requires a Agent Name");
hadErr = true;
}
if (vflag)
System.out.println("Agent Name = " + aName);
} else if (arg.equals("-c")) {
if (i < args.length && !args[i].startsWith("-")) {
cfgID = args[i++];
} else {
System.err.println("\n-c requires a Configuration ID");
hadErr = true;
}
if (vflag)
System.out.println("Configuration ID = " + cfgID);
} else if (arg.equals("-s")) {
if (i < args.length && !args[i].startsWith("-")) {
system = args[i++];
} else {
System.err.println("\n-s requires a System Name");
hadErr = true;
}
if (vflag)
System.out.println("System Name = " + system);
} else if (arg.equals("-g")) {
if (i < args.length && !args[i].startsWith("-")) {
group = args[i++];
} else {
System.err.println("\n-g requires a System Group Name");
hadErr = true;
}
if (vflag)
System.out.println("System Group Name = " + group);
} else if (arg.equals("-u")) {
if (i < args.length && !args[i].startsWith("-")) {
userID = args[i++];
} else {
System.err.println("\n-u requires a User Name");
hadErr = true;
}
if (vflag)
System.out.println("User Name = " + userID);
} else if (arg.equals("-p")) {
if (i < args.length && !args[i].startsWith("-")) {
passwd = args[i++];
} else {
System.err.println("\n-p requires a Password");
hadErr = true;
}
if (vflag)
System.out.println("Password = " + passwd);
} else if (arg.equals("-f")) {
if (i < args.length && !args[i].startsWith("-")) {
filter = args[i++];
} else {
System.err.println("\n-f requires a Filter String in \"quotes\"");
hadErr = true;
}
if (vflag)
System.out.println("Filter = " + filter);
} else if (arg.equals("-o")) {
if (i < args.length && !args[i].startsWith("-")) {
sort = args[i++];
} else {
System.err.println("\n-o requires a Sort String in \"quotes\"");
hadErr = true;
}
if (vflag)
System.out.println("Sort = \"" + sort + "\"");
}
}
if (args.length == 0 || i != args.length || hadErr) {
System.err.println("Usage: MQWorkflowAPIDriver [-verbose] -a AgentName -c ConfigID -s SysName -g GrpName [-u userID] [-p Password] [-f \"filter\"] [-o \"sort\"]");
System.exit(-1);
}
else {
TerminateProcInst driver = new TerminateProcInst(aName, cfgID, system, group, userID, passwd, filter, sort);
driver.execute();
}
}
/*
* Instantiates an Execution Service object and logs the user in
*/
public void initializeExecutionService() throws FmcException {
Agent agent = new Agent();
try {
agent.setConfigurationID(this.CONFIGURATION_ID);
agent.setName(this.AGENT_NAME);
} catch (java.beans.PropertyVetoException pve) {
System.out.println( "PropertyVetoException occurred setting up Agent object. Program exit..." );
pve.printStackTrace();
System.exit(-1);
}
this.wfService = agent.locate(GROUP, SYSTEM);
/*wfService.logon(USERID, PWD); //error if user is still logon, see logon2() for force logon
*/
wfService.logon2(USERID,
PWD,
com.ibm.workflow.api.ServicePackage.SessionMode.PRESENT_HERE,
com.ibm.workflow.api.ServicePackage.AbsenceIndicator.NOT_SET);
System.out.println( "Logon successfully userid = " + USERID );
}
public void execute() {
try {
this.initializeExecutionService();
this.terminateProcessInstance();
} catch (Exception ex) {
if (ex instanceof FmcException) {
//Catch and report details about the FmcException
FmcException e = (FmcException)ex;
if ( e.rc == FmcException.FMC_ERROR_ALREADY_LOGGED_ON ) {
System.out.println("Already Logged On Error");
//do something to recover
}
else {
System.out.println("FmcException occured");
System.out.println("RC :"+e.rc);
System.out.println("Origin :"+e.origin);
System.out.println("MessageText:"+e.messageText);
System.out.println("Exception :"+e.getMessage());
System.out.println("Parameters :");
for (int i =0; i<e.parameters.length; i++) {
System.out.println(""+e.parameters [i]);
}
}
}
System.out.println("StackTrace :");
ex.printStackTrace();
} finally {
if (wfService != null) {
try {
wfService.logoff();
System.out.println("\nSuccessfully logged off " + USERID);
}
catch (Exception ex) { System.out.println("Error logging out."); }
}
}
}
/*
* Step 1. Querys for an exsisting process instance with specified TPID.
* Step 2. If one exists, it is deleted from WF.
*/
void terminateProcessInstance() throws FmcException {
String instanceName = null;
/* Step 1 - Query */
ProcessInstance[] pInstance =
wfService.queryProcessInstances("NAME LIKE 'T*'", this.SORT_STR, new Integer(this.THREASHOLD));
/* Step 2 - Delete all process instances */
for (int i=0; i < pInstance.length && i < this.THREASHOLD; i++) {
instanceName = pInstance[i].name();
pInstance[i].terminate();
System.out.println("Sucessfully terminated process instance " + instanceName);
}
}
} |
|
Back to top |
|
 |
vennela |
Posted: Tue Aug 08, 2006 1:04 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
|
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
|
|
|
|