[jBPM] - jBPM Generic Command Executor
by Mauricio Salatino
Mauricio Salatino [https://community.jboss.org/people/salaboy21] modified the document:
"jBPM Generic Command Executor"
To view the document, visit: https://community.jboss.org/docs/DOC-47545
--------------------------------------------------------------
Serveral times in the System Integration Field when we are dealing external system (System To System) calls (1) we don't want to block(2) the caller until the remote service process and send us back the results (3).
https://community.jboss.org/servlet/JiveServlet/showImage/102-47545-1-195... https://community.jboss.org/servlet/JiveServlet/downloadImage/102-47545-1...
In the context of business processes, we need to deal with this kind of situations regularly, and there is a strong need to be able to delegate a System Call to a decoupled component that will be in charge of handling the required System Call for us to not block our Business Process Engine execution. For long running persistent timers we have a similar situation:
https://community.jboss.org/servlet/JiveServlet/showImage/19593/no-execut... https://community.jboss.org/servlet/JiveServlet/downloadImage/19593/477-2...
We have a business timer, which can be scheduled to due in 48hs. Technically we need to keep a thread for that specific timer in order to call a specific system as soon as it due. The thread that is in charge of monitoring the Timer will be also in charge of calling System 1 in this case and it will block until System 1 returns the results for that call. The application containing the timer, is just another application, but in this case, instead of wanting to call System 1 inmediately there will be a span of time that needs to be waited in order to do the external system call.
Generally speaking, The Executor Componentneeds to be able to receive requests to schedule asynchronous tasks executions (as soon as possible or derefered in time). In some way, this component will be exposed as a service. It will need to be available to the requester -- it could be a remote client or a direct (in jvm) reference. Once this component receives and acknowledges the request, it needs to have a way to pick a request (from a request inbox or list) and then execute that request. Usually, this mechanism contains retrying mechanisms as well as an exception handling mechanism that allows us to recover the execution if something fails with the external application (for example, if it’s not available at a particular point in time). This component must have a way of contacting the requester back to notify it when the execution is done. To do this, the component usually stores a business key that allows us to achieve the notification successfully.
https://community.jboss.org/servlet/JiveServlet/showImage/19595/executor-... https://community.jboss.org/servlet/JiveServlet/downloadImage/19595/execu...
>From the (any) application point of view, the executor component is just another service that we can use in order to delegate executions. Instead of interacting directly with another applications we will use the Executor Component as an Intermediary that will allow us to handle all our external interactions asynchronously. Besides this important feature there are another important things that the executor component can do for us:
1. Derefered Executions: if our application needs to wait for long period of time in order to execute a task, we can delegate that responsability to the executor component.
2. Retry Mechanism: If a scheduled job cannot contact the external system, we can configure a number of retries for each particular job.
3. Generic Exception Handling: Based on the expcetions reported by the external system, we can automatically decide if we want to retry or if we want to call another service instead
4. Administrator Queue: If all the retrying mechanism fails several times or if we have a failed execution that cannot be retried, a task can be created for the administrator to fix the problem, correct the environment and retry the job manually.
This executor service will use the Command Pattern (http://en.wikipedia.org/wiki/Command_pattern) in order to schedule remote executions. These commands will contain the logic that needs to be executed, allowing us to create new commands if we have special requirements
.
The Executor Service just exposes two methods:
public interface Executor extends Service{
public String scheduleRequest(String commandName, CommandContext ctx);
public void cancelRequest(String requestId);
}
The scheduleRequest method will receive the name of the command that we want to schedule and a CommandContext, contain among another things the business key that we can use to make reference to this particular execution, that will be used to gather all the information required to execute the request.
In order to use this service we will need to configure it accordingly based on our business requirements. For some scenarios we need a service that this component monitors the list of request all the time and we have not urgent tasks that can wait to be executed, for example twice a day.
The executor service will be running as a separate component of our application and it will need to be initialized when we know that another component will be trying to schedule new requests to be executed.
Different implementations for this interface can be provided depending on the environments where we are planning to deploy the component.
One important thing is that multiple Executor Component instances can be instantiated and configured to work with different configurations in the same environment, providing us an scalable way to support several concurrent request executions.
The following link points to a PoC of this component, based on CDI/Weld and Seam Persistence & Transactions, in the same way that the new Human Task Service module is working. Providing a simple implementation for SE environments using a Database as a BackEnd. More advanced implementations using MDBs can be provided for working in EE environments.
https://github.com/Salaboy/human-task-poc-proposal/tree/master/executor-s... https://github.com/Salaboy/human-task-poc-proposal/tree/master/executor-s...
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-47545]
Create a new document in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
13 years, 6 months
[JBoss Tools] - m2e-wtp 0.16.0 has been released!
by Fred Bricon
Fred Bricon [https://community.jboss.org/people/fbricon] modified the blog post:
"m2e-wtp 0.16.0 has been released!"
To view the blog post, visit: https://community.jboss.org/community/tools/blog/2012/09/28/m2e-wtp-0160-...
--------------------------------------------------------------
h2. Finally!
Last March, Max was blogging (https://community.jboss.org/community/tools/blog/2012/03/28/moving-m2e-wt...) about moving the m2eclipse-wtp project to the Eclipse Foundation. We already had a website (https://www.eclipse.org/m2e-wtp/),
now I'm proud to announce the move is complete with the immediate availability of m2e-wtp 0.16.0, straight up from Eclipse.org's servers
and just in time to accompany the Juno SR1 release.
This 0.16.0 release, while being primarily focused on bug fixes from the former m2eclipse-wtp version, add some new features to help you convert your Java EE Eclipse projects to Maven.
http://wiki.eclipse.org/images/a/a0/M2e-wtp-0160-convert-web-part03.png http://wiki.eclipse.org/images/a/a0/M2e-wtp-0160-convert-web-part03.png
Take a look at the http://wiki.eclipse.org/M2E-WTP/New_and_Noteworthy/0.16 New and Noteworthy and https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&bug_statu... changelog to learn more about what's in for you.
h2. Installation and gotchas
m2e-wtp requires at least m2e 1.1 (though 1.2 is recommended) and can be installed from its p2 update site : http://download.eclipse.org/m2e-wtp/releases/ or the Eclipse Marketplace (http://marketplace.eclipse.org/node/441371).
*Please note that, m2e-wtp and Sonatype's m2eclipse-wtp overlap and can not be installed together.*
* if you try to update your Eclipse installation via "*+Help > Install New Software...+*", m2e-wtp won't install because of the conflict with m2eclipse-wtp (this is a bug in p2).
* if you add the m2e-wtp update site to your list of Available Update Sites, doing "*+Help > Find Updates+*" should find m2e-wtp as a suitable replacement for m2eclipse-wtp, and everything should update properly.
The safest path to upgrade is to start from a clean Eclipse installation. Good thing you just downloaded Juno SR1 right?
Oh, by the way, JBoss Tools 4.0.0.Alpha2 and JBDS 6.0.0 Alpha2, coming in the next few days, will be compatible with m2e-wp 0.16.0.
h2. Looking forward
The project is still incubating at the Eclipse Foundation, while we're working on stabilizing it, its API and working on new features. We're hoping to make m2e-wtp part of the Kepler release train,
and why, not integrate it direclty into the Eclipse Java EE distribution next June.
Finally I'd like to give some kudos to the WTP team from IBM, who was really instrumental with the project migration to eclipse.org and who also provided several patches to m2e-wtp.
I'm confident that, together, we'll be able to greatly improve both m2e-wtp and WTP itself.
Enjoy,
Fred.
https://twitter.com/#!/fbricon https://twitter.com/#!/fbricon
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/community/tools/blog/2012/09/28/m2e-wtp-0160-...]
13 years, 6 months
[jBPM] - JPAWorkingMemoryDbLogger logs inconsistent data in case the process instance flow starts and terminates in single thread
by Rahul Agrawal
Rahul Agrawal [https://community.jboss.org/people/rahulamt] created the discussion
"JPAWorkingMemoryDbLogger logs inconsistent data in case the process instance flow starts and terminates in single thread"
To view the discussion, visit: https://community.jboss.org/message/762097#762097
--------------------------------------------------------------
When a process is defined such that there are no wait-states in the flow i.e. the process instance flow will be completed in the same thread, in which it is started, the JPAWorkingMemoryDbLogger is not recording the end data for that particular ProcessInstanceLog.
One more point: I am starting the transaction and commiting it.
More analysis reveals that
In case of start and completion of the process instance in the single thread the below method will execute the query.
But as the transaction is not commited the query is unable to find the processinstancelog object.
private void updateProcessLog(long processInstanceId) {
List<ProcessInstanceLog> result = getEntityManager().createQuery(
"from ProcessInstanceLog as log where log.processInstanceId = ? and log.end is null")
.setParameter(1, processInstanceId).getResultList();
if (result != null && result.size() != 0) {
ProcessInstanceLog log = result.get(result.size() - 1);
log.setEnd(new Date());
getEntityManager().merge(log);
}
}
My work-around is to have a map field JPAWorkingMemoryDbLogger inside this class it will store the processInstanceLog object created against the processInstanceId and inside the above method if query is unable to find the object, use the object from the map. If the EntityManager is able to find processInstanceLog, remove it from the map.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/762097#762097]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 6 months
[jBPM] - How to back to previous node from current user task node
by Jack G
Jack G [https://community.jboss.org/people/super_man.sh] created the discussion
"How to back to previous node from current user task node"
To view the discussion, visit: https://community.jboss.org/message/761025#761025
--------------------------------------------------------------
I'm using jBPM5.3 now. I use JPA to persist KnowledgeSession infomation.I use my custome WorkItemHandler to replace the default MinaHTWorkItemHandler or WSHumanTaskHandler for user task node.My custom WorkItemHandler code as below:
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
DefaultTask task=new DefaultTask();
task.setNodeInstanceId(this.getNodeInstance(workItem).getId());
task.setWorkItemId(workItem.getId());
task.setName(workItem.getName());
task.setOwner((String)workItem.getParameter("ActorId"));
task.setCmnt((String)workItem.getParameter("Comment"));
task.setState(TaskState.created);
task.setCreate(new Date());
task.setProcessInstanceId(workItem.getProcessInstanceId());
task.setSessionId(this.getSession().getId());
this.getNodeInstance(workItem);
taskManager.addTask(task);//persistent task info to db
}
Now,I want to back to previous node from current user task node with programming type,non modeling type.Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/761025#761025]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 6 months