-
1. Re: BPMN 2.0 Service Task
kukeltje Feb 25, 2010 3:54 PM (in response to david_geary)1 of 1 people found this helpfulFrom what I can see in the example unit test this creates a new instance of the specified java class (JavaService) when the process executes, in fact if you call the method twice it creates the object twice.
Correct, that is the behaviour. The default service type in BPMN2.0 (http://www.omg.org/spec/BPMN/2.0/) is 'webservice' (you can see the high BPEL type overhead here). What the behaviour of services should be is not explicitly mentioned in the spec afaik (did not look at it lately) but webservices are mostly stateless, as are java services (tasks) in jPDL, so it is not strange that they are to be seen as stateless.
Surely a service is more likely to have a lifecycle external to the process?
No, not in this scope. That is more going towards orchestrations or conversations in BPMN
How can I 'inject' a prexisting service instance into the process?
Injecting them is not possible (yet?) but resolving classes, variables etc like in jPDL will probably be implemented one way or another in the future. More flexibility will be achieved then
Specifically is it possible to access externally defined spring beans?
No, not afaik, but see the answer to the previous question.Cheers,
Ronald
-
2. Re: BPMN 2.0 Service Task
david_geary Feb 26, 2010 10:13 AM (in response to kukeltje)Thanks for the reply - very useful, but Im still wondering is it in any way possible to wire in collaborating objects to the service task instance eg other service objects, remoting, messaging, database etc - I cant see much use for a standalone class to be constructed unless it comunicates with something else?
Or are these service tasks just supposed to execute some local logic in java eg performing a calculation and return the result? What would be a typical example?
From what you said would I be correct in assuming there will at some point be support for the expression lanaguage to resolve bean references eg like in the current spring support in jpdl?
Thanks again
Dave
-
3. Re: BPMN 2.0 Service Task
camunda Feb 26, 2010 11:12 AM (in response to david_geary)Hey Dave.
You have to do that basically yourself. Either calling a EJB or getting a Spring bean or using Google Juice or whatever from this class. Obviously you are right, the typical use case is to call a real service. But this is up to you how you use the engine.
Cheers
Bernd
-
4. Re: BPMN 2.0 Service Task
kukeltje Feb 26, 2010 11:34 AM (in response to david_geary)Bernd is right... It could e.g. be calling a 'local' esb that in turn does something remote or like jPDL will have in 4.4, an 'EJB service' where you configure jndi name etc... For the moment, be creative...;-) Do whatever you want do do from the java class.
Ronald
-
5. Re: BPMN 2.0 Service Task
david_geary Feb 26, 2010 11:55 AM (in response to camunda)OK, but surely I stll need to be able to get a reference to the local ESB or to JNDI or a spring application context etc ie ideally I need dependency injection on the constructed class. The only way I can see to do this for now would be to use static fields or do a hard coded lookup. -
6. Re: BPMN 2.0 Service Task
kukeltje Feb 26, 2010 1:02 PM (in response to david_geary)or pass a variable that contains the correct info (look at what is passed e.g. to the jPDL ejb node -
7. Re: BPMN 2.0 Service Task
jensaug Mar 1, 2010 11:32 AM (in response to kukeltje)Hi,
To me this looks as a sweet place to use CDI - then that service could IRL be an EJB, JavaBean, have a life cycle etc. Is there any particular reasoning against getting the reference within jBPM using CDI? JSE5 compatibility I guess? And the fact that the CDI spec came only two weeks before your 4.3 release...
Nice work, ya'll.
br,
Jens
-
8. Re: BPMN 2.0 Service Task
kukeltje Mar 1, 2010 12:06 PM (in response to jensaug)Is there any particular reasoning against getting the reference within jBPM using CDI?
JSE5 compatibility I guess?
Hmmm... not sure how CDI influences jBPM in this regard... afaik JSE5 is still the target. Maybe CDI is backwardscompatible?
And the fact that the CDI spec came only two weeks before your 4.3 release...
Yep... played a big part.
-
9. Re: BPMN 2.0 Service Task
jensaug Mar 1, 2010 12:20 PM (in response to kukeltje)kukeltje wrote:
JSE5 compatibility I guess?
Hmmm... not sure how CDI influences jBPM in this regard... afaik JSE5 is still the target. Maybe CDI is backwardscompatible?
Quite right, I ran to the Weld site and checked: "Java SE 5.0 and above". Great, thus not an obstacle.