Package org.alfresco.event.outbox
Class OutboxBuilder
java.lang.Object
org.alfresco.event.outbox.OutboxBuilder
Creates an
For the performance reasons the events are processed in batches (default behaviour). It means that more than one event can be retried. In some corner cases all events in the batch might be retried. The events will be still delivered in order. If it's important to prevent this behaviour the
Implementation Note - Concurrency:
Multiple
Outbox instance backed by the relational database. Created instance relays the events using the At Least Once Delivery semantic. It means that:
- it will try to participate in the already running Transaction while storing events
- an
OutboxExceptionwill be thrown on storing event failure - events will be delivered in order - but might be retried
For the performance reasons the events are processed in batches (default behaviour). It means that more than one event can be retried. In some corner cases all events in the batch might be retried. The events will be still delivered in order. If it's important to prevent this behaviour the
OutboxConfig.getFetchLimit() can be used to set the batch size to 1. Implementation Note - Concurrency:
Multiple
Outbox instances can work together and still provide the same guarantees as if there were only one Outbox instance. It means that it can be used in a clustered environment.-
Method Summary
Modifier and TypeMethodDescriptionbuild()static OutboxBuilderforAutodetectedDb(ConnectionSource connectionSource) Creates a newOutboxBuilderwhich will detect (lazily) the database using the providedConnectionSource.withConfig(OutboxConfig config) Configures theOutboxConfigused by theOutboximplementation.withMetricsAdapter(MetricsAdapter metricsAdapter) Configures theMetricsAdapterused by theOutboximplementation.withOutboundEventConsumer(EventConsumer outboundEventConsumer) Configures the outboundEventConsumerwhich is used to relay the stored events to the target system in an asynchronous way.
-
Method Details
-
forAutodetectedDb
Creates a newOutboxBuilderwhich will detect (lazily) the database using the providedConnectionSource.- Parameters:
connectionSource- aConnectionSourceused to detect the database type. It will be also used by the finalOutboximplementation.- Returns:
- an
OutboxBuilder
-
withOutboundEventConsumer
Configures the outboundEventConsumerwhich is used to relay the stored events to the target system in an asynchronous way.
If not configured the events will be discarded.- Parameters:
outboundEventConsumer- anEventConsumer.- Returns:
- an
OutboxBuilderfor chaining the build steps.
-
withMetricsAdapter
Configures theMetricsAdapterused by theOutboximplementation.
If not configured the metrics are not reported.- Parameters:
metricsAdapter- aMetricsAdapter- Returns:
- an
OutboxBuilderfor chaining the build steps.
-
withConfig
Configures theOutboxConfigused by theOutboximplementation.
If not provided the default config will be used.- Parameters:
config- anOutboxConfig- Returns:
- an
OutboxBuilderfor chaining the build steps.
-
build
-