-
1. Re: Bijection and jBpm Node actions
mtorres Jun 21, 2008 1:02 AM (in response to mtorres)I continued playing around with the scenario, looks like the problem is not necessarily a node action, but when actions are called when deeper jbpm nodes are traversed.
<start-state name="start"> <transition to="startNode"/> </start-state> <node name="startNode"> <action expression="#{loanProcessing.startNodeAction}"></action> <transition name="next" to="secondNode"></transition> </node> <node name="secondNode"> <action expression="#{loanProcessing.secondNodeAction}"></action> <transition name="next" to="initialContact"></transition> </node>
For the snippet above, bijection works when loanProcessing.startNodeAction gets called but does not happen when loanProcessing.secondNodeAction is invoked.
-
2. Re: Bijection and jBpm Node actions
mtorres Jun 24, 2008 9:31 PM (in response to mtorres)Did some more digging on this, even Decision nodes has this problem. During debug, I noticed that seam(through SeamELResolver, Namespace and Context) is pulling out the component(loanProcessing) from the method context. This caused the BijectionInterceptor not to be invoked, hence the loanId was not set.
The relevant interceptor chain is as follows:
...MethodContextInterceptor -- BusinessProcessInterceptor -- ConversationInterceptor -- BijectionInterceptor...Is there any solution/fix to this, Or any workarounds? I understand that splitting the action component to multiple classes may sort of work, but I'd prefer to keep things in the same class.
Any insight on this is appreciated.
-
3. Re: Bijection and jBpm Node actions
mtorres Jun 27, 2008 4:41 PM (in response to mtorres)I just wanted to share what I have done to work around this problem.
I created an interceptor that sits between MethodContextInterceptor and BusinessProcessInterceptor to remove the component from the MethodContext. This interceptor is only activated on jBpmHandlers, by means of an annotation.
The relevant codes are
Interceptor
@SuppressWarnings("serial")
@Interceptor(stateless = true, within = MethodContextInterceptor.class,
public class JbpmHandlerInterceptor extends AbstractInterceptor{
@AroundInvoke
public Object aroundInvoke(InvocationContext ctx) throws Exception {
Component comp = getComponent();
if (comp!=null){
String name = comp.getName();
Contexts.getMethodContext().set(name,null);
}
Object ret = ctx.proceed();
return ret;
}
}Annotation
@Target(TYPE)
@Retention(RUNTIME)
@Interceptors(JbpmHandlerInterceptor.class)
public @interface JbpmHandler {
}jBpm Handler class
@Name("loanProcessing")
@JbpmHandler
public class LoanProcessingAction {
...
}It worked in my test scenario so far, but since I have no deep knowledge of the framework, I cant tell if there's a scenario that this will break. Do you foresee any problems related to this approach?
-
4. Re: Bijection and jBpm Node actions
mtorres Jun 27, 2008 4:42 PM (in response to mtorres)Just reformatting my previous post.
@SuppressWarnings("serial") @Interceptor(stateless = true, within = MethodContextInterceptor.class, public class JbpmHandlerInterceptor extends AbstractInterceptor{ @AroundInvoke public Object aroundInvoke(InvocationContext ctx) throws Exception { Component comp = getComponent(); if (comp!=null){ String name = comp.getName(); Contexts.getMethodContext().set(name,null); } Object ret = ctx.proceed(); return ret; } }
@Target(TYPE) @Retention(RUNTIME) @Interceptors(JbpmHandlerInterceptor.class) public @interface JbpmHandler { }
@Name("loanProcessing") @JbpmHandler public class LoanProcessingAction { ... }
-
5. Re: Bijection and jBpm Node actions
ophidian Jul 28, 2008 8:27 AM (in response to mtorres)I've ran into this same issue. While your solution does seem to fix most of the problem, bijection still fails for any components added to the business process context during the first node execution.
I'm new to both Seam and JBPM, but will try to play around with this a little more before conceding and splitting up my action. Here's what appears to be the relevant bug (which you've already found) for others if they happen upon this same issue: JBSEAM-3095
-
6. Re: Bijection and jBpm Node actions
ophidian Jul 28, 2008 10:11 AM (in response to mtorres)Sorry, I had a misconfiguration on my part. The above interceptor does appear to be a full solution to the issue. From what I understand, the whole idea of having the MethodContextInterceptor to not contain the proxied object is to prevent some horribleness when the component is invoked recursively. So using this JbpmHandler appears to be a solid choice when used carefully. Thanks for posting your solution.
-
7. Re: Bijection and jBpm Node actions
c0upal Sep 12, 2008 10:14 PM (in response to mtorres)Hi.
Your workaround works for me.
I have a problem where i need a processInstance object to be injected on a method, and needs to signal to a transition.
Your workaround made me successfully inject a processInstance object to my Bean.
see post: http://www.seamframework.org/Community/JbpmNodeNodeTypeWithActionExpressionDoesNotContinue
Thanks for your posting.
-
8. Re: Bijection and jBpm Node actions
svadu Sep 13, 2008 1:23 AM (in response to mtorres)Might be a good idea for a JIRA issue...