public static class DbSchedulerEventScheduler.Builder extends Object
DbSchedulerEventScheduler
.
The TransactionManager
is defaulted to a NoTransactionManager
. The useBinaryPojo
and
startScheduler
are defaulted to true
.
The Scheduler
, Serializer
and EventBus
are hard requirements and as such should be
provided.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
DbSchedulerEventScheduler |
build()
Initializes a
DbSchedulerEventScheduler as specified through this Builder. |
DbSchedulerEventScheduler.Builder |
eventBus(EventBus eventBus)
Sets the
EventBus used to publish events on once the schedule has been met. |
DbSchedulerEventScheduler.Builder |
scheduler(com.github.kagkarlsson.scheduler.Scheduler scheduler)
Sets the
Scheduler used for scheduling and triggering purposes of the events. |
DbSchedulerEventScheduler.Builder |
serializer(Serializer serializer)
|
DbSchedulerEventScheduler.Builder |
startScheduler(boolean startScheduler)
Sets whether to start the
Scheduler using the Lifecycle , or to never start the scheduler from
this component instead. |
DbSchedulerEventScheduler.Builder |
stopScheduler(boolean stopScheduler)
Sets whether to stop the
Scheduler using the Lifecycle , or to never stop the scheduler from
this component instead. |
DbSchedulerEventScheduler.Builder |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used to build transactions and ties them on event publication. |
DbSchedulerEventScheduler.Builder |
useBinaryPojo(boolean useBinaryPojo)
Sets whether to use a pojo optimized for size,
DbSchedulerBinaryEventData , compared to a pojo
optimized for readability, DbSchedulerEventScheduler . |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public DbSchedulerEventScheduler.Builder scheduler(com.github.kagkarlsson.scheduler.Scheduler scheduler)
Scheduler
used for scheduling and triggering purposes of the events. It should have either
the DbSchedulerEventScheduler.binaryTask(Supplier)
or the DbSchedulerEventScheduler.humanReadableTask(Supplier)
from this class as one of its
tasks to work. Which one depends on the setting of useBinaryPojo
. When true
, use
DbSchedulerEventScheduler.binaryTask(Supplier)
else DbSchedulerEventScheduler.humanReadableTask(Supplier)
. Depending on you application, you
can manage when to start the scheduler, or leave startScheduler
to true, to start it via the
Lifecycle
.scheduler
- a Scheduler
used for scheduling and triggering purposes of the eventspublic DbSchedulerEventScheduler.Builder serializer(Serializer serializer)
serializer
- a Serializer
used to de-/serialize the payload
, and MetaData
.public DbSchedulerEventScheduler.Builder transactionManager(TransactionManager transactionManager)
TransactionManager
used to build transactions and ties them on event publication. Defaults
to a NoTransactionManager
.transactionManager
- a TransactionManager
used to build transactions and ties them on event
publicationpublic DbSchedulerEventScheduler.Builder eventBus(EventBus eventBus)
EventBus
used to publish events on once the schedule has been met.eventBus
- a EventBus
used to publish events on once the schedule has been metpublic DbSchedulerEventScheduler.Builder useBinaryPojo(boolean useBinaryPojo)
DbSchedulerBinaryEventData
, compared to a pojo
optimized for readability, DbSchedulerEventScheduler
.useBinaryPojo
- a boolean
to determine whether to use a binary format.public DbSchedulerEventScheduler.Builder startScheduler(boolean startScheduler)
Scheduler
using the Lifecycle
, or to never start the scheduler from
this component instead. Defaults to true
.startScheduler
- a boolean
to determine whether to start the scheduler.public DbSchedulerEventScheduler.Builder stopScheduler(boolean stopScheduler)
Scheduler
using the Lifecycle
, or to never stop the scheduler from
this component instead. Defaults to true
.stopScheduler
- a boolean
to determine whether to stop the scheduler.public DbSchedulerEventScheduler build()
DbSchedulerEventScheduler
as specified through this Builder.DbSchedulerEventScheduler
as specified through this Builderprotected void validate() throws AxonConfigurationException
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2024. All rights reserved.