[JBoss Seam] - trouble with Asynch
by javajoe220
Hello,
I am very interested in using the @Asynchronous and Event.raiseAsynchronousEvent functionality. However, its lack of access to the Conversation and Session scope is difficult to work around. The documentation states the following:
anonymous wrote : We usually use an asynchronous call when we want to return an immediate response to the client, and let some expensive work be processed in the background. This pattern works very well in applications which use AJAX, where the client can automatically poll the server for the result of the work.
|
This sounds great and is exactly what we want to do! A brief summary is as follows:
1) A user does a search.
2) When the user selects a search results it kicks off a conversation and several areas are initialized in respect to the selected search item via Event / Observer. Each Observer is in a stateful session bean with a conv. scope.
3) We then access the data we need from each bean.
I would really like to make these initialization routines async without doing some context gymnastics to get the results in the conversation scope. The doc I quoted suggests "polling" but unless we put the results in the business or application scope I don't see how it is possible. Please let me know if I am missing something here or if you may have any suggestion?
Thank you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030051#4030051
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030051
19Â years, 1Â month
[JBoss Seam] - Re: Seam jBPM: use annotation or pages.xml to get next task?
by bsmithjj
"gavin.king(a)jboss.com" wrote : Of course, if you created it yourself via some other mechanism, *you* will have to associate it will the conversation using BusinessProcess.instance().setProcessId( processInstance.getId() ).
|
| Seam isn't magic. Seam only knows about processes it creates or retrieves. If you get it yourself, by going to jBPM APIs directly, then it is up to you to do the job of associating it with the conversation.
I realize what you're saying above about Seam - I'm attempting to use the EL as you showed earlier to have an ActionHandler invoke a Seam component instead of having to implement an ActionHandler which you claim I should never have to do ;-). Anyway, now we're coming to why I suggested earlier the possibility of creating a Seam-jBPM interceptor that fires around the execute(...) method in an ActionHandler, DecisionHandler, etc...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030050#4030050
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030050
19Â years, 1Â month
[JBoss Seam] - Re: Seam jBPM: use annotation or pages.xml to get next task?
by bsmithjj
In our application, a user may create a 1-N entities we call AccessRequests. In the SFSB method which is invoked by the user on submit, we create a loop to create each AccessRequest and create a ProcessInstance with that AccessRequest's id as a process variable. In this particular use case, we signal up to the 'provisioning' state previously described. Here is the code that creates the N ProcessInstances (inside the braces of a for loop):
| // Load the JBPM context
| JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| // Create new process, associate with this access request and save
| ProcessInstance process = jbpmContext.newProcessInstance("NewAccessRequest");
| process.getContextInstance().setVariable("accessRequestId", accessRequest.getId());
| Contexts.getEventContext().set(
| "accessRequest",
| accessRequest
| );
| Token token = process.getRootToken();
| token.signal(); // move to <task-node name="User Manager Approve-Reject Request">
| and flushed).");
|
|
| Collection<TaskInstance> tasks = (Collection<TaskInstance>) process.getTaskMgmtInstance().getTaskInstances();
|
| // Thd jBPM API sucks (3.1.4) - this is the only way I can find of ending the current task
| // along the 'approve' transition
| for (TaskInstance task : tasks) {
| if ("Approve/Reject".equals(task.getName())) {
| task.end("approve");
| break;
| }
| }
|
| jbpmContext.close();
|
|
thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030046#4030046
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030046
19Â years, 1Â month