onUndeliveredAction

open fun ShutdownContext<S, I, A>.onUndeliveredAction(action: A)

Called when an action is not delivered to the store.

This can happen according to the Channel's documentation:

  • When the Store's ActionShareBehavior is ActionShareBehavior.Distribute or ActionShareBehavior.Restrict. In this case, depending on the configuration, the queue of actions may have a limited buffer and overflow.

  • When store is stopped before this event could be received by subscribers.

  • When the subscriber cancels their subscription or throws before it could process the action.

  • When the store is stopped and there were actions in the buffer, in which case, onUndeliveredAction will be called on all of them.

Warning:

This function is called in an undefined coroutine context on a random thread, while the store is running or already stopped. It should be fast, non-blocking, and must not throw exceptions, or the store will crash. The onException block will not handle exceptions in this function.