[jboss-user] [jBPM] - Re: Asynchronous service tasks and transactions

Rahul Agrawal do-not-reply at jboss.com
Fri Aug 24 08:05:10 EDT 2012


Rahul Agrawal [https://community.jboss.org/people/rahulamt] created the discussion

"Re: Asynchronous service tasks and transactions"

To view the discussion, visit: https://community.jboss.org/message/755752#755752

--------------------------------------------------------------
Hi,

I doing it the same way but not directly. I am not registering my handler with kession. But the completeWorkItem(workItemId, result) i am calling on the same session. The call to this method is not inside the handler but inside an ejb that is called from the new thread that i am calling.

My workItemHandler is as follows:

public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {


                    final String operation = (String) workItem.getParameter("Operation");


                    final WorkItem internalWorkItem = workItem;
                    final WorkItemManager internalWorkItemManager = manager;


                    new Thread(new Runnable() 
                    {
                                   public void run() 
                                   {

               Map<String, Object> inParams = internalWorkItem.getParameters();
                                                                           inParams.put("workItemId",Long.valueOf(internalWorkItem.getId()));

                                                                           inputParams.add((Serializable)inParams);

                                                                      try
                                                                      {
                                                                                     results = EJBCallLookUP.call(operation, inputParams);
            }
           catch(Exception e)
          {
                    e.printStackTrace();
          }

        }
  }).start();
}

in the EJBCallLookUP.call I am looking up the ejb for the operation and calling the method with operation name. Inside that operation i am calling the completeWorkItem(...) with the session.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/755752#755752]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120824/2c88e230/attachment-0001.html 


More information about the jboss-user mailing list