Ignite Events
Since Camel 2.17
Only consumer is supported
The Ignite Events endpoint is one of camel-ignite endpoints which allows you to receive events from the Ignite cluster by creating a local event listener.
The Exchanges created by this consumer put the received Event object into the body of the IN message.
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Ignite Events component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
A Spring XML configuration of Ignite to start a new Ignite node with (Ignition.start): a URL, an InputStream, or a String with the path or URL of the file. It takes precedence over igniteConfiguration, and is ignored when ignite is set. The component stops the node when it stops. | Object | ||
An existing Ignite instance to use, instead of starting a new Ignite node. The component neither starts nor stops it, and ignores configurationResource and igniteConfiguration. | Ignite | ||
An IgniteConfiguration to start a new Ignite node with (Ignition.start), used when neither ignite nor configurationResource is set. The component stops the node when it stops. | IgniteConfiguration | ||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |
Endpoint Options
The Ignite Events endpoint is configured using URI syntax:
ignite-events:endpointId
With the following path and query parameters:
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
A ClusterGroupExpression that returns the ClusterGroup of the IgniteEvents (Ignite.events(ClusterGroup)). It has no effect: the consumer listens with IgniteEvents.localListen, which receives the events of the local node only. | ClusterGroupExpression | ||
The event types to listen to: the names of EventType constants, separated by commas without spaces, such as EVT_CACHE_OBJECT_PUT,EVT_CACHE_OBJECT_REMOVED. EVTS_ALL is all event types; other EVTS_ groups are not supported, and unknown names are ignored. Ignite records only the event types that its IgniteConfiguration includes (includeEventTypes). | EVTS_ALL | String | |
Whether the producer keeps the incoming message body when the Ignite operation has no result, such as a cache PUT, REMOVE or CLEAR, a queue PUT or CLEAR, a set CLEAR, a compute RUN or AFFINITY_RUN, or a messaging send. When false, the body is null after such an operation. Not used by ignite-idgen and ignite-events. | true | boolean | |
Whether a Collection in the body is one object, instead of several elements. By default a cache PUT of a Map without the CamelIgniteCacheKey header puts each of its entries, a cache GET or REMOVE of a Set works on each of its keys, a queue or set ADD, CONTAINS or REMOVE works on each element, and an UNORDERED messaging send sends each element as a message. When true, the Collection is stored, looked up or sent as one object. Not used by ignite-compute, ignite-idgen and ignite-events. | false | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern |
Message Body
The message body at each side of the Ignite Events component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| The Ignite Event, such as a CacheEvent or a JobEvent, with its type in type(); no headers are set. Ignite fires only the event types its configuration includes (includeEventTypes). |
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Usage
The component needs an Ignite node: Ignite describes the ways to give it one.
The consumer receives the events of the types in events, the names of the EventType constants, separated by commas without spaces. Ignite records only the event types that its configuration includes (includeEventTypes of the IgniteConfiguration):
- route:
from:
uri: ignite-events:cacheEvents
parameters:
events: EVT_CACHE_OBJECT_PUT,EVT_CACHE_OBJECT_REMOVED
steps:
- log:
message: "Event: ${body}"