Class JobRunrEventScheduler
java.lang.Object
org.axonframework.eventhandling.scheduling.jobrunr.JobRunrEventScheduler
- All Implemented Interfaces:
EventScheduler,Lifecycle
EventScheduler implementation that delegates scheduling and triggering to a JobRunr JobScheduler.
- Since:
- 4.7.0
- Author:
- Gerard Klijs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate aJobRunrEventScheduler.Nested classes/interfaces inherited from interface org.axonframework.lifecycle.Lifecycle
Lifecycle.LifecycleHandler, Lifecycle.LifecycleRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate aJobRunrEventSchedulerbased on the fields contained in theJobRunrEventScheduler.Builder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiate a Builder to be able to create aJobRunrEventScheduler.voidcancelSchedule(ScheduleToken scheduleToken) Cancel the publication of a scheduled event.voidThis function should only be called via Jobrunr when a scheduled event was triggered.voidThis function should only be called via Jobrunr when a scheduled event was triggered.voidpublishWithRevision(String serializedPayload, String payloadClass, String revision) This function should only be called via Jobrunr when a scheduled event was triggered.voidpublishWithRevision(String serializedPayload, String payloadClass, String revision, String serializedMetadata) This function should only be called via Jobrunr when a scheduled event was triggered.voidRegisters the activities to be executed in the various phases of an application's lifecycle.Schedule the giveneventfor publication after the giventriggerDuration.Schedule the giveneventfor publication at the giventriggerDateTime.voidshutdown()Shuts down this event scheduler.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.eventhandling.scheduling.EventScheduler
reschedule, reschedule
-
Constructor Details
-
JobRunrEventScheduler
Instantiate aJobRunrEventSchedulerbased on the fields contained in theJobRunrEventScheduler.Builder.Will assert that the
JobScheduler,SerializerandEventBusare notnull, and will throw anAxonConfigurationExceptionif any of them isnull.- Parameters:
builder- theJobRunrEventScheduler.Builderused to instantiate aJobRunrEventSchedulerinstance
-
-
Method Details
-
builder
Instantiate a Builder to be able to create aJobRunrEventScheduler.The
TransactionManageris defaulted to aNoTransactionManager.The
JobScheduler,SerializerandEventBusare hard requirements and as such should be provided.- Returns:
- a Builder to be able to create a
JobRunrEventScheduler
-
schedule
Description copied from interface:EventSchedulerSchedule the giveneventfor publication at the giventriggerDateTime. The returned ScheduleToken can be used to cancel the planned publication. The giveneventmay be any object, as well as an EventMessage. In the latter case, the instance provided is the donor for the payload and Meta Data of the actual message being dispatched. In the former case, the giveneventwill be wrapped as the payload of an EventMessage.- Specified by:
schedulein interfaceEventScheduler- Parameters:
triggerDateTime- The moment to trigger publication of the eventevent- The event to publish- Returns:
- the token to use when cancelling the schedule
-
schedule
Description copied from interface:EventSchedulerSchedule the giveneventfor publication after the giventriggerDuration. The returned ScheduleToken can be used to cancel the planned publication. The giveneventmay be any object, as well as an EventMessage. In the latter case, the instance provided is the donor for the payload and Meta Data of the actual message being dispatched. In the former case, the giveneventwill be wrapped as the payload of an EventMessage.- Specified by:
schedulein interfaceEventScheduler- Parameters:
triggerDuration- The amount of time to wait before publishing the eventevent- The event to publish- Returns:
- the token to use when cancelling the schedule
-
cancelSchedule
Description copied from interface:EventSchedulerCancel the publication of a scheduled event. If the events has already been published, this method does nothing.- Specified by:
cancelSchedulein interfaceEventScheduler- Parameters:
scheduleToken- the token returned when the event was scheduled
-
shutdown
public void shutdown()Description copied from interface:EventSchedulerShuts down this event scheduler.- Specified by:
shutdownin interfaceEventScheduler
-
registerLifecycleHandlers
Description copied from interface:LifecycleRegisters the activities to be executed in the various phases of an application's lifecycle. This could either be at startup, shutdown, or both.- Specified by:
registerLifecycleHandlersin interfaceLifecycle- Parameters:
lifecycle- the lifecycle instance to register the handlers with- See Also:
-
publish
This function should only be called via Jobrunr when a scheduled event was triggered. It will create anEventMessageand publish it using theEventBus. -
publish
This function should only be called via Jobrunr when a scheduled event was triggered. It will create anEventMessageand publish it using theEventBus. -
publishWithRevision
This function should only be called via Jobrunr when a scheduled event was triggered. It will create anEventMessageand publish it using theEventBus. -
publishWithRevision
public void publishWithRevision(String serializedPayload, String payloadClass, String revision, String serializedMetadata) This function should only be called via Jobrunr when a scheduled event was triggered. It will create anEventMessageand publish it using theEventBus.
-