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, wait
reschedule, reschedule
protected 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.
JobRunrEventScheduler
public ScheduleToken schedule(Instant triggerDateTime, Object event)
EventScheduler
event
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 EventScheduler
triggerDateTime
- The moment to trigger publication of the eventevent
- The event to publishpublic ScheduleToken schedule(Duration triggerDuration, Object event)
EventScheduler
event
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 EventScheduler
triggerDuration
- The amount of time to wait before publishing the eventevent
- The event to publishpublic void cancelSchedule(ScheduleToken scheduleToken)
EventScheduler
cancelSchedule
in interface EventScheduler
scheduleToken
- the token returned when the event was scheduledpublic void shutdown()
EventScheduler
shutdown
in interface EventScheduler
public void registerLifecycleHandlers(@Nonnull Lifecycle.LifecycleRegistry lifecycle)
Lifecycle
registerLifecycleHandlers
in interface Lifecycle
lifecycle
- 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–2024. All rights reserved.