AnsweredAssumed Answered

Next steps for the spring component integration

Question asked by tombaeyens on Feb 28, 2011
Latest reply on Mar 8, 2011 by meyerd
[27/02/11 12:47:23] Josh Long: ive officially got 70% of what i wanted to support in the component code for the Spring module working. i wondered if i might talk to you about the last 30% :)
[27/02/11 12:54:39] Josh Long: at the moment, there is support for:

1) Activiti POJOs:

class CustomerService {
   public  void enrollCustomer(@ProcessVariable('customerId') long customerId) { … }


@Autowired private CustomerService cs ;
// …
cs.enrollCustomer( 232) ; // automatically launches a ProcessInstance

2) scoped beans

@Scoped('process") Foo foo ; //the bean is created and destroyed on process instance lifecycle demarcations

Inside of Foo, i imght have the following declaration:

// injects the current process instance 'customerId'
@Value( "#{ processVariables['customerId'] }")
private long customerId;

I can also do:

@Autowired private ProcessInstance processInstance ;

in any bean - scoped or not. its injects a proxy so that, even if the containg bean is not scoped, the methods called on the ProcessInstance are to the currently active, scoped ProcessInstance and so it is threadsafe.

[27/02/11 12:59:41] Josh Long: let me know when youre free - i want to talk about the possibility of having serviceTasks that delegate to a single registered instance so that i could simply write:

<serviceTask id="notifyCustomer" />

and, since no bean is explicitly configured, a default bean gets invoked and that bean, in my case, is a Spring handler that would look at the fact that the
<serviceTask> is named 'notifyCustomer' and would look for a POJO that has

@ActivitiMapping(serviceTask ='notifyCustomer')
public void myCustomServiceTaskHandlerMethod ( @ProcessVariable('customerId') long customerId) {
   // ..

and would automatically call it