public interface Subscription
Subscription.suppressDuplicateEvents().orderEvents();
It's very important to understand that the order of builder invocations matters.
For example Subscription.filterEvents().suppressDuplicateEvents();
is different than Subscription.suppressDuplicateEvents().filterEvents();
In the first case events are filtered and just after that duplicates are suppressed which may be faster than first suppressing the duplicates and just after than filter the ones you're not interested in. So think about what exactly you want your subscription to do and in which order before making it.
Modifier and Type | Method and Description |
---|---|
Subscription |
addPreprocessor(org.apache.camel.Processor preprocessor)
Adds a preprocessor to the subscription route.
|
Subscription |
filterEvents(java.lang.String simpleFilter)
Filters events out on the EDA client side so consumers don't have to do
this themselves.
|
Subscription |
filterEvents(java.lang.String header,
java.lang.String value)
Filters events out on the EDA client side so consumers don't have to do
this themselves.
|
Subscription |
filterEventsOnServerSide(java.lang.String serverSideFilter)
Filters events out on the Event Bus (server side filtering).
|
java.util.List<Configuration> |
getConfigurations()
Returns an unmodifiable ordered list containing the different
configurations used by this subscription.
|
java.util.List<org.apache.camel.Processor> |
getPreprocessors()
Returns an unmodifiable ordered list of all the preprocessors added by
EDA clients to this subscription.
|
org.apache.camel.Processor |
getProcessor()
Provides a reference to the last processor of the processing chain which
will receive the events once all other operations have been completed.
|
Subscription |
orderEvents()
Enables reordering of events by the time-stamp in $Event$Start header
for consumers using this subscription.
|
Subscription |
orderEvents(OrderEventsConfiguration config)
Configures this subscription to reorder events as specified by custom configuration.
|
Subscription |
suppressDuplicateEvents() |
Subscription |
suppressDuplicateEvents(DuplicateEventsConfiguration config) |
Subscription |
useDurableSubscription(java.lang.String clientId,
java.lang.String subscriptionName)
Creates a durable subscription which receive messages while the subscriber is not active.
For more detailed information please see Session.createDurableSubscriber(javax.jms.Topic, String) and
Connection.setClientID(String) |
Subscription |
useThreadPool(int poolSize)
Configures the subscription to use a thread pool with the specified size.
|
Subscription |
useThreadPool(ThreadPoolConfiguration config)
Configures the subscription to use a thread pool with the specified
configuration.
|
java.util.List<Configuration> getConfigurations()
Subscription.suppressDuplicateEvents()
a new configuration
will be added to the list.java.util.List<org.apache.camel.Processor> getPreprocessors()
#addPreprocessor(Processor)} - Used for adding preprocessors.
org.apache.camel.Processor getProcessor()
#getPreprocessors()} - Returns a list of all previously added
preprocessors.
Subscription addPreprocessor(org.apache.camel.Processor preprocessor)
preprocessor
- - The preprocessor that has to be added to the subscription
route.Subscription useDurableSubscription(java.lang.String clientId, java.lang.String subscriptionName)
Session.createDurableSubscriber(javax.jms.Topic, String)
and
Connection.setClientID(String)
clientId
- an unique client ID which can only be used by a single JMS connection instance.subscriptionName
- durable subscriber name for specifying durable topic subscriptions.Subscription suppressDuplicateEvents()
Subscription suppressDuplicateEvents(DuplicateEventsConfiguration config)
Subscription filterEvents(java.lang.String header, java.lang.String value)
filterEvents("${header.<name>} == '<value>'")
. For
example the following code
filterEvents("$Event$Kind", "Event")
is equivalent to
filterEvents("${header.$Event$Kind} == 'Event'")
. The later
one uses Camel's Simple Language directly. Both will only allow events of
kind "Event" to pass through, all "Heartbeat" events will be filtered
out.header
- - The name of the header you want your filter to be based on.value
- - The value of the header you want your filter to be based on.#filterEvents(String)} - Provides more powerful client side
filter capabilities based on Camel's Simple language.
,
#filterEventsOnServerSide(String)} - Filters events out on
the server side using a JMS message selector.
Subscription filterEvents(java.lang.String simpleFilter)
filterEvents("${header.$Event$Kind} == 'Event'")
. This code
will only allow events of kind "Event" to pass through, all "Heartbeat"
events will be filtered out.simpleFilter
- - A Camel simple language filter. For more information check
Apache Camel online documentation.#filterEventsOnServerSide(String)} - Filters events out on
the server side using a JMS message selector.
,
Camel's Simple
LanguageSubscription filterEventsOnServerSide(java.lang.String serverSideFilter)
filterEventsOnServerSide("$Event$Kind == 'Event'")
. This code
will only allow events of kind "Event" to pass through, all "Heartbeat"
events will be filtered out, all events will be filtered on the JMS
provider side.serverSideFilter
- - A JMS message selector filter.Subscription orderEvents()
OrderEventsConfiguration
,
Resequencer EIPSubscription orderEvents(OrderEventsConfiguration config)
OrderEventsConfiguration
.config
- - A set of parameters used for reordering. For example, a header name by which the events are compared.Subscription useThreadPool(int poolSize)
poolSize
- The size of the pool. In this case it's also equal to the
maximum pool size.Subscription useThreadPool(ThreadPoolConfiguration config)
config
- - The configuration which should be used for configuring the
thread pool parameters such as default size, maximum pool
size, and thread name template to be used.