akka-projection icon indicating copy to clipboard operation
akka-projection copied to clipboard

Graceful shutdown of source providers

Open seglo opened this issue 4 years ago • 3 comments

When a RunningProjection is stopped, call an (internal only?) async shutdown method in the source provider.

seglo avatar Jul 14 '20 15:07 seglo

There are multiple reasons for a projection to stop:

  1. the application is gracefully terminating
  2. the projection is programmatically stopped (sharded projection moved to another ShardRegion) and may be restarted
  3. the envelope handler errored (or there's a projection failure) and the projection will be (or should be) restarted

@seglo , did you have any of these reasons in mind?

ignasi35 avatar Jul 15 '20 13:07 ignasi35

@ignasi35 I didn't have any specific cause in mind. I only noticed that the projection has no way of signalling the source provider to shutdown except by way of the SharedKillSwitch. I was wondering if there was a way to use Alpakka Kafka's DrainingControl in non-exceptional shutdown circumstances.

seglo avatar Jul 16 '20 14:07 seglo

I think this is a good idea. That would make it independent of the kind of kill switch is in use.

octonato avatar Jul 17 '20 10:07 octonato