Class CracEventPublisher

java.lang.Object
io.micronaut.crac.CracEventPublisher

@Singleton public class CracEventPublisher extends Object
A helper bean to assist in publishing the correct CRaC events when a checkpoint is taken or restored.
Since:
1.0.0
Author:
Tim Yates
  • Constructor Details

    • CracEventPublisher

      public CracEventPublisher(CracConfiguration cracConfiguration, io.micronaut.context.event.ApplicationEventPublisher<BeforeCheckpointEvent> beforeCheckpointEventPublisher, io.micronaut.context.event.ApplicationEventPublisher<AfterRestoreEvent> afterRestoreEventPublisher)
      Parameters:
      cracConfiguration - The CRaC configuration.
      beforeCheckpointEventPublisher - The publisher for BeforeCheckpointEvent events.
      afterRestoreEventPublisher - The publisher for AfterRestoreEvent events.
  • Method Details

    • fireBeforeCheckpointEvents

      public void fireBeforeCheckpointEvents(@NonNull @NonNull OrderedResource resource, @NonNull @NonNull LongSupplier action)
      Fires a BeforeCheckpointEvent event.
      Parameters:
      resource - The @{link OrderedResource} that is being checkpointed.
      action - The action to perform that returns the time taken in nanoseconds.
    • fireBeforeCheckpointEvents

      public void fireBeforeCheckpointEvents(@NonNull @NonNull OrderedResource resource)
      Fires a BeforeCheckpointEvent event with no action to be performed.
      Parameters:
      resource - The @{link OrderedResource} that is being checkpointed.
    • fireAfterRestoreEvents

      public void fireAfterRestoreEvents(@NonNull @NonNull OrderedResource resource, @NonNull @NonNull LongSupplier action)
      Fires an AfterRestoreEvent event.
      Parameters:
      resource - The @{link OrderedResource} that is being restored.
      action - The action to perform that returns the time taken in nanoseconds.
    • fireAfterRestoreEvents

      public void fireAfterRestoreEvents(OrderedResource resource)
      Fires an AfterRestoreEvent event with no action to be performed.
      Parameters:
      resource - The @{link OrderedResource} that is being restored.