Sagas vs. BPMN Engine

763 views
Skip to first unread message

michael-hamburg

unread,
May 13, 2011, 2:31:12 AM5/13/11
to Axon Framework Users
Hi Allard,

I'm currently thinking about using a BPMN engine ( http://www.activiti.org/
) instead of using Axon's Sagas. It looks like as if all Saga
functionality can be easiliy replaced with BPMN functionality -
Moreover it seems to me as if a Saga is simply a subset of what a BPMN
workflow describes. A big benefit of BPMN is also the visual design of
the workflow (aka Saga).

Is there something I am missing?

Cheers,
Michael

Allard Buijze

unread,
May 13, 2011, 2:42:45 AM5/13/11
to axonfr...@googlegroups.com
Hi Michael,

doing something like this has crossed my mind more than once, actually. You're not missing anything at all. Sagas are very good candidates to use BPM engines for.

I was thinking of building a JBPMSagaManager that starts a process using the jpdl library. Events can trigger the processes, which in turn trigger activites (e.g. send a command, event, email, whatever). The SagaManager interface should be really easy to implement.

Cheers,

Allard

michael-hamburg

unread,
May 13, 2011, 3:22:19 AM5/13/11
to Axon Framework Users
Hi Allard,

> I was thinking of building a JBPMSagaManager that starts a process using the
> jpdl library. Events can trigger the processes, which in turn trigger
> activites (e.g. send a command, event, email, whatever). The SagaManager
> interface should be really easy to implement.

But isn't this duplicating the things BPMN engines already handle?

Activiti for example uses a database to store processes, handles timer
events... All you have to do is to inject the appropriate Axon
aggregate repositories into such a process and call the appropriate
methods on the aggregates. I don't get the point what the benefit of
the Axon saga part is (beyond having a simple standard Saga
implementation).

Cheers,
Michael

michael-hamburg

unread,
May 13, 2011, 4:01:58 AM5/13/11
to Axon Framework Users
Correction: The BPMN process is just a normal client that uses the
command and query services as any other non-automated client.

Allard Buijze

unread,
May 13, 2011, 2:31:48 PM5/13/11
to axonfr...@googlegroups.com
Hi Michael,

I don't know about infiti, I have to admit. If it can work as a client, there is abolutely nothing wrong with that.

The implementation I was thinking about was with jPDL. It is a stripped down version of a BPM engine. The api requires you to find a specific process instance and you can trigger a token on that instance to move around in the process. The SagaManager I had in mind could track which event should trigger which process instance. So it manages the "associations", but not much more. jPDL also allows scheduling of tasks. No need to use the EventScheduler there as well.

So I am not really duplicating anything, just creating an adapter between the jPDL api (process, token, trigger, etc) and Axon's API (event).

Cheers,

Allard

Allard Buijze

unread,
May 13, 2011, 2:56:19 PM5/13/11
to axonfr...@googlegroups.com
infinit?!? make that activiti....

Sounds like I need a week-end.

Reto

unread,
May 16, 2011, 1:41:41 PM5/16/11
to Axon Framework Users
I was thinking in the same direction with a BPM System like Activiti
or Xpert.ivy. I'm just not sure atm if i would replace the sagas with
a BPM System. In my mind it was more like for the process steps with
interaction or calling some "external" System. But anyway, i'm in the
beginning to understand the system and i would be very happy if you,
Michael, could share your Axon/Activiti experience with me ;-).

Cheers,

Reto
Switzerland

Allard Buijze

unread,
May 16, 2011, 3:03:55 PM5/16/11
to axonfr...@googlegroups.com
Hi Michael,

I've been reading into where the power of Activit really is. It seems to me that it serves a different purpose than Saga's.

Saga's are transaction managers. The big difference with "regular" transaction managers is that they manage "base" transactions instead of acid ones. They don't have any user interaction. 
Activiti allows you to create workflows, including those with user interaction. Building such a workflow on top of a CQRS+EDA based architecture could have a lot of potential. Your tasks can react on events or send out commands. The biggest difference with a Saga is that it would ultimately be triggered by an action in the User Interface.

Cheers,

Allard

michael-hamburg

unread,
May 17, 2011, 4:49:15 AM5/17/11
to Axon Framework Users
Hi Allard,

I prefer thinking about a Saga as a kind of Automated User. This user
starts doing things on arrival of message, on specific time intervals,
etc. and does some personal bookkeeping. In the process started by
some kind of trigger the user sends commands to aggregates. This is
exactly what a BPMN engine like Activiti can do. Therefore it's not
only triggered by an action in the user interface.

Maybe it's a good idea just to try it out and see what's happening.
(May take some time because finishing the "Meta CQRS" generator is on
top of my ToDo list at the moment).

@Reto: I'll post my experiences here

Cheers,
Michael
> >>> > implementation).- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Viggo Navarsete

unread,
Jun 26, 2013, 6:52:45 AM6/26/13
to axonfr...@googlegroups.com
Hi Michael!

I've also been playing with the thoughts of using Axon and Activiti together. Have you had the time to test it, and what was your conclusion?

Regards,
Viggo

Sean Yin

unread,
Oct 12, 2017, 9:42:05 PM10/12/17
to Axon Framework Users
Hi Michael,

How is your experience of using BPMN engine as saga? I am very interested in this approach, because I am currently working on a saga project which is a standalone component like BPMN.

We are having problem deciding how to handle complex transactions with conditional dependency among sub-transactions.

For example, either sub-transaction b or c is run, depending on the response of sub-transaction a.
  a
 /  \
b  c

If using BPMN, the business logic leaks into BPMN, how do you handle this kind of transaction? Or is this just a bad practice?
Reply all
Reply to author
Forward
0 new messages