@SPI public class DeliveryMonitor extends java.lang.Object
In some cases when a funnel-like
Entity (e.g. some projection of a business report
subscribed to half of the domain events) has a lot of messages in its
the delivery process may be slowed down for other targets in the same shard, while
all the messages are being dispatched the "busy"
Entity. Depending on the number
of messages to deliver, it may take a lot of time.
Environments such as Google AppEngine Standard imply restrictions on the duration of the request processing. Therefore, it may be necessary to stop the message delivery for this shard at some point, and re-schedule the shard processing again by sending another request and thus resetting the processing clock.
|Constructor and Description|
|Modifier and Type||Method and Description|
Called once some delivery process has completed and the corresponding shard has been released.
Determines if the delivery execution should be continued after the given stage is completed.
public boolean shouldContinueAfter(io.spine.server.delivery.DeliveryStage stage)
false is returned, the ongoing delivery run for the served shard will be
stopped at this application node. The node will release the previously
picked up shard.
To trigger the new delivery processing for this shard, use Delivery.deliverMessagesFrom(ShardIndex).
This method is called synchronously, meaning that the delivery process will not resume until a value is returned from this method call.
stage- the stage of delivery which has ended
trueto continue the delivery,
public void onDeliveryCompleted(DeliveryStats stats)
The descendants may override this method to understand when it is safe to pick up the corresponding shard again. Another usage scenario is calculation of the message delivery throughput.
stats- the statistics of the performed delivery
public void onDeliveryStarted(io.spine.server.delivery.ShardIndex index)