I've already been retrieved details of a specific AS/400 job by its job number. I have a problem. I want to get that specific jobs thread detail. Some jobs have multi threading. I need to get specific job's list of multi threads and thread details. I'm checked jt400 doc for finding some class for it. But I'm failing to find :(
Thank in Advance!
JobList jobList = new JobList(System);
jobList.clearJobSelectionCriteria();
jobList.addJobSelectionCriteria(JobList.SELECTION_JOB_NUMBER, jobNumber);
Enumeration list = jobList.getJobs();
while (list.hasMoreElements()) {
Job j = (Job) list.nextElement();
System.out.println(j.getName());
System.out.println(j.getStatus());
System.out.println(j.getOutputQueue());
}
The API you're looking for is QWCOLTHD. JTOpen 8.1 was recently released and I don't see the QWCOLTHD API implemented.
It looks like you either need to email the developers and ask for this API, or write the implementation yourself. JTOpen is open source; you can get the source code and see how similar APIs are implemented and then write the appropriate classes for QWCOLTHD.
Related
I am just writing an Interface between a java application and an AS400.
For this purpose I use jt400. I managed to get information about the systemstatus like CPU usage, as well I managed to receive the current status about subsystems and jobs.
Now I am searching for an option to have a look at the different job queues inside the AS400.
For example: I would like to know, how many jobs are in which queue.
Is there a solution via jt400 or a different approach to access those information via java?
The corresponding command inside AS400 is WRKJOBQ
Best
LStrike
[Edit]
The following code is my filter for JobList. But how do I configure QSYSObjectPathName that it is matching WRKJOBQ?
QSYSObjectPathName path = new QSYSObjectPathName(.....);
JobList jList = new JobList(as400);
jList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, true);
jList.addJobSelectionCriteria(JobList.SELECTION_JOB_QUEUE, path.getPath());
Job[] jobs = jList.getJobs(-1, 1);
System.out.println("Jobs Size: " + jobs.length);
You can use a JobList object for that, using SELECTION_JOB_QUEUE to filter jobs.
Once your selection suits your need, JobList#getLength() will give you the number of jobs.
See also this question
I am running a Hadoop jar file inside a cluster. From the documentation, I know that Hadoop manages JobID, Start time etc. Is it possible to get the parameters so that we can show them on our web interface just to let user know how much time the job will consume (e.g. estimated duration)?
All the details shown in the Jobtracker UI can be obtained easily by using the APIs provided.
Use jobclient API refer : https://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapred/JobClient.html
and Jobstatus api refer : https://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapred/JobStatus.html
Using the combination of jobclient and jobstatus(jobsToComplete(), getAllJobs() ) you can retrieve the JobId . Once you get the jobId you can easily get all the other details by just calling the functions in the API.
This question is specifically related to the JT400 class ProgramCallDocument, with it's method callProgram(String ProgramName)
I've tried wapping the call in a try/catch - but it's not throwing an exception, the debugger goes into the callProgram method, and just sits there indefinitely.
A small amount of specific information about the API is available here:
http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.toolbox.doc/rzahhxpcmlusing.htm
Here's the code that I'm running:
AS400 as400System = AS400Factory.getAS400System()
ProgramCallDocument programCallDocument = new ProgramCallDocument(as400System, "com.sample.xpcml.Sample.xpcml")
programCallDocument.setStringValue("sampleProgramName.value", sampleValue)
Boolean didProgramCallDocumentRunSuccessfullyOnTheAS400 = programCallDocument.callProgram("sampleProgramName")
The last line of that snippet is the one that just sits there. I left out the try/catch for brevity.
The XPCML file that the ProgramCallDocument constructor uses is just a proprietary XML format that IBM uses for specifying the parameter lengths and types for a program call. I can come back and add it in if it would be helpful, but the ProgramCallDocument constructor runs validation on the XML, and it didn't come up with any validation errors. I'm not familiar with JT400, or how it does Program Calls, so any assistance would be wonderful.
As a further note, doing some more digging on a related issue today I also found this SO post:
Monitor and handle MSGW messages on a job on an IBM i-series (AS/400) from Java
I think it's relevant to this question, because it's about ways to trap MSGW status on the Java/Groovy side.
It's very likely the called program went into a MSGW status (error).
Check WRKACTJOB JOB(QZRCSRVS) to find the program call job and see the status as well as review the job log.
It may be easier to call a native program using the CommandCall class or as a JDBC stored procedure.
Here's an example of the CommandCall usage in Groovy:
sys = AS400Factory.AS400System
cmd = new CommandCall(sys)
if (!cmd.run "CALL MYLIB.MYPGM PARM('${sampleValue}')") {
println cmd.messageList
}
I am using jBPM 5.3.0, but i have a problem when i try to implement LocalTaskService for Human Task.
I try this code:
org.jbpm.task.service.TaskService taskService = new org.jbpm.task.service.TaskService(getEntityManagerFactory(), SystemEventListenerFactory.getSystemEventListener());
SyncWSHumanTaskHandler syncWSHumanTaskHandler = new SyncWSHumanTaskHandler();
syncWSHumanTaskHandler.setLocal(true);
TaskService localTaskService = new LocalTaskService(taskService);
syncWSHumanTaskHandler.setClient(localTaskService);
getKnowledgeSession().getWorkItemManager().registerWorkItemHandler("Human Task", syncWSHumanTaskHandler);
But it seems that the SyncWSHumanTaskHandler is deprecated.
So i would like to know if someone implement it in the last release of jBPM and have some samples.
Thank you,
You can always find unit tests that shows the functionality:
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/process/workitem/wsht/local/sync/WSHumanTaskHandlerLocalSyncTest.java
That test shows how to use the new classes. As I've already answered here:
https://community.jboss.org/message/738956
We are trying to keep all the implementation aligned with the same names for all the transports and for the async and sync implementations. The new Human Task WorkItemHandlers are called:
AbstractHTWorkItemHandler -> GenericHTWorkItemHandler & AsyncGenericHTWorkItemHandler -> Then the concrete implementation for the different transports: LocalHTWorkItemHandler, HornetQHTWorkItemHandler and Mina...
Using LocalTaskService is ok.
Cheers
I would like to know how to create outlook "Task Request" in java.
Here is another Java lib: http://moonrug.com/
I have used an earlier version of this API in my previous job. It is a commercial product.
Trying to code purely from memory and looking at the examples provided by the Moyosoft website. I have no means to compile or execute this. But you will get an idea on how to proceed
Outlook outlookApplication = new Outlook();
// Get the Task folder where the task has to be created
OutlookFolder taskFolder= outlookApplication.getDefaultFolder(FolderType.TASKS);
//Creating a new Task
OutlookTask task = new OutlookTask (taskFolder);
task.setSubject("New Java Task"); //Name of the Task
task.setStart(new Date()); // creating task with current server time
task.setStatus(TaskStatus.NOT_STARTED); //task has not yet started
task.setOwner("owner's_email#example.com"); // I don't whether this is name or email.
task.setReminderTime(new Date()) //set a reminder time, set appropriately
task.setDueDate(new Date()); //deadline for the task completion, set appropriately
// and so one.
The following APIs should help you.
http://www.moyosoft.com/joc/javadocplus/?docclass=com.moyosoft.connector.ms.outlook.task.OutlookTaskRequest
http://www.moyosoft.com/joc/javadocplus/?docclass=com.moyosoft.connector.ms.outlook.task.OutlookTask
The complete java docs can be found here. It is not very well documented but the API names are self explanatory.
http://www.moyosoft.com/joc/javadocplus/
Their site also have a few code examples which was helpful in figuring it out.
I hope this is helpful. I do not have access to these APIs now, therefore I have no way to provide code examples.