Hi
I am looking for a sponsor for a new extension I am working on.
https://github.com/jangalinski/camunda-bpm-reactorSince I worked with the somewhat limited event/subscribe mechanism in the engine-cdi module I had this idea of making some couplings of model and code more "aspect-oriented". If for example (see our skill based routing showcase) I always call the same rule service to determine candidate groups, why do I have to add a listener to every task in every model.
This can be achieved by using a parse listener to programmatically add listeners to every element. Problem: now the engine has to know the code of the listener, otherwise we get a CNFE. If we could decouple engine and listener, we would be safe and could use whatevercode we like to implement the functionality,as long as we have access to the eventBus the engine is publishing to.
Thats where this extension comes into play:
I used the EventBus from
projectreactor.io. Its a really cool project and mainly focusses on RxJava, async streams and so on, but they also have the rather simple bus in place that allows to separate event-topic and event-payload. Other then with the engine-cdi approach, I do not need qualifiers, I use a topic URI:
/camunda/{type}/{process}/{element}/{event}When the engine publishes an task create event, it uses
/camunda/userTask/Process_1/UserTask_2/create and wraps the delegateTask to a reactor Event<DelegateTask>.
I now can have multiple subsribers to this event:
leaving everything unspecified "
/camunda/{type}/{process}/{element}/{event}" means: I get notified for everything that happens
if I am only interested in task creations, I subsribe to
/camunda/userTask/{process}/{element}/create, now I get all task create events for all processes and tasks
and if i am interested in the very task mentioned above, I use the full topic: /camunda/userTask/Process_1/UserTask_2/create
Of course this can easily be configured via annotations:
@CamundaSelector(type = "userTask", event = TaskListener.EVENTNAME_CREATE)
public class TaskCreateListener extends SubscriberTaskListener {
public TaskCreateListener() {
register(CamundaReactor.eventBus());
}
@Override
public void notify(DelegateTask delegateTask) {
....
}
}I got this pretty far, we are planning to use this approach in production. I know you guys are busy with the 7.4, but I would be happy if you could have a look into it (there are tests and a small example project available) and give me your feedback.
And I hope that I will find a sponsor who helps me bringing this over to the camunda repo as a community extension. I would be also glad if anyone wants to help me on this, I could use an additional pair of eyes and input.
Thanks
Jan