public class JobRunrEventScheduler extends Object implements EventScheduler, Lifecycle
| Modifier and Type | Class and Description |
|---|---|
static class |
JobRunrEventScheduler.Builder
Builder class to instantiate a
JobRunrEventScheduler. |
Lifecycle.LifecycleHandler, Lifecycle.LifecycleRegistry| Modifier | Constructor and Description |
|---|---|
protected |
JobRunrEventScheduler(JobRunrEventScheduler.Builder builder)
Instantiate a
JobRunrEventScheduler based on the fields contained in the
JobRunrEventScheduler.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static JobRunrEventScheduler.Builder |
builder()
Instantiate a Builder to be able to create a
JobRunrEventScheduler. |
void |
cancelSchedule(ScheduleToken scheduleToken)
Cancel the publication of a scheduled event.
|
void |
publish(String serializedPayload,
String payloadClass)
This function should only be called via Jobrunr when a scheduled event was triggered.
|
void |
publish(String serializedPayload,
String payloadClass,
String serializedMetadata)
This function should only be called via Jobrunr when a scheduled event was triggered.
|
void |
publishWithRevision(String serializedPayload,
String payloadClass,
String revision)
This function should only be called via Jobrunr when a scheduled event was triggered.
|
void |
publishWithRevision(String serializedPayload,
String payloadClass,
String revision,
String serializedMetadata)
This function should only be called via Jobrunr when a scheduled event was triggered.
|
void |
registerLifecycleHandlers(Lifecycle.LifecycleRegistry lifecycle)
Registers the activities to be executed in the various phases of an application's lifecycle.
|
ScheduleToken |
schedule(Duration triggerDuration,
Object event)
Schedule the given
event for publication after the given triggerDuration. |
ScheduleToken |
schedule(Instant triggerDateTime,
Object event)
Schedule the given
event for publication at the given triggerDateTime. |
void |
shutdown()
Shuts down this event scheduler.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreschedule, rescheduleprotected JobRunrEventScheduler(JobRunrEventScheduler.Builder builder)
JobRunrEventScheduler based on the fields contained in the
JobRunrEventScheduler.Builder.
Will assert that the JobScheduler, Serializer and EventBus are not null, and will
throw an AxonConfigurationException if any of them is null.
builder - the JobRunrEventScheduler.Builder used to instantiate a JobRunrEventScheduler instancepublic static JobRunrEventScheduler.Builder builder()
JobRunrEventScheduler.
The TransactionManager is defaulted to a NoTransactionManager.
The JobScheduler, Serializer and EventBus are hard requirements and as such should
be provided.
JobRunrEventSchedulerpublic ScheduleToken schedule(Instant triggerDateTime, Object event)
EventSchedulerevent for publication at the given triggerDateTime. The returned
ScheduleToken can be used to cancel the planned publication.
The given event may 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 given event will be wrapped as the payload of an EventMessage.schedule in interface EventSchedulertriggerDateTime - The moment to trigger publication of the eventevent - The event to publishpublic ScheduleToken schedule(Duration triggerDuration, Object event)
EventSchedulerevent for publication after the given triggerDuration. The
returned ScheduleToken can be used to cancel the planned publication.
The given event may 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 given event will be wrapped as the payload of an EventMessage.schedule in interface EventSchedulertriggerDuration - The amount of time to wait before publishing the eventevent - The event to publishpublic void cancelSchedule(ScheduleToken scheduleToken)
EventSchedulercancelSchedule in interface EventSchedulerscheduleToken - the token returned when the event was scheduledpublic void shutdown()
EventSchedulershutdown in interface EventSchedulerpublic void registerLifecycleHandlers(@Nonnull Lifecycle.LifecycleRegistry lifecycle)
LifecycleregisterLifecycleHandlers in interface Lifecyclelifecycle - the lifecycle instance to register the handlers withLifecycle.LifecycleRegistry.onShutdown(int, Runnable),
LifecycleRegistry#onShutdown(int, LifecycleHandler),
Lifecycle.LifecycleRegistry.onStart(int, Runnable),
LifecycleRegistry#onStart(int, LifecycleHandler)public void publish(String serializedPayload, String payloadClass)
EventMessage and publish it using the EventBus.public void publish(String serializedPayload, String payloadClass, String serializedMetadata)
EventMessage and publish it using the EventBus.public void publishWithRevision(String serializedPayload, String payloadClass, String revision)
EventMessage and publish it using the EventBus.Copyright © 2010–2023. All rights reserved.