Projection as process manager

I think per-stream projections are perfect to create stateful process managers, however the scheduling bit is missing. Is there any reasonable way to go around this limitation without using any external scheduler?

There is not an internal scheduler and I don't see us adding one.
Schedulers have a tendency of exploding in complexity :slight_smile:

can you explain this stateful process manager concept? I’m learning.
I know that a process manager controls the flow by sending commands when some events are emitted but how would you concretly implement that witht the projections?

The projection library supports emit(...)

the scheduler, how it is implemented and what is its purpose

the “external” scheduler

For scheduling messages to be delivered in the future.


I suspected so but it is always good to ask. As per my understanding, it would require some functionality that has no other use in the product and does not fit with the purpose of storing/handling events…

The EventStore has this functionality to create projections per stream, which can have own state. Such projection can receive all events per individual stream or several streams and update its own state and emitting other events that might have some subscribers or projections that do some other work.

Sometimes you need the aspect of time, the classic example is:

  • Order placed
  • Schedule a payment status check in one day
  • If order has been paid - remove the schedule and emit OrderPaid
  • If schedule fires - send a reminder or remove the order
    Something like that. Popular implementations of process managers (aka sagas, which upsets Greg) based on message buses line MassTransit or NServiceBus have scheduling functionality built-in.

For me the advantage of using projections is low latency since the state machine works inside the event store, so we are not transferring anything over the wire.

And as soon as we add it someone would want to schedule a message for
1500 PST on the 3rd day of the month of the month following holiday X
on the hebrew calendar. Time is hard.

May be I can make something like MassTransit made with Quartz.NET, but with EventStore to listen and emit events.

Sure no worries so long as its on the outside. Its quite easy to drop
a service on the outside. I wouldn't even mind seeing as an OSS
project people could use. If they don't like it and want some other
weirdly complex thing they can always drop their own there.