You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Camel Ignite component

Available as of Camel 2.17

Apache Ignite In-Memory Data Fabric is a high-performance, integrated and distributed in-memory platform for computing and transacting on large-scale data sets in real-time, orders of magnitude faster than possible with traditional disk-based or flash technologies. It is designed to deliver uncompromised performance for a wide set of in-memory computing use cases from high performance computing, to the industry most advanced data grid, highly available service grid, and streaming. See all features.

This component offers seven endpoints to cover much of Ignite's functionality:

  • Ignite Cache.
  • Ignite Compute.
  • Ignite Messaging.
  • Ignite Events.
  • Ignite Sets.
  • Ignite Queues.
  • Ignite ID Generator.

To use this component, add the following dependency to your pom.xml:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-ignite</artifactId>
    <version>${camel.version}</version> <!-- use the same version as your Camel core version -->
</dependency>

URI formats and options

Ignite Cache endpoint

This endpoint allows you to interact with an IgniteCache:

ignite:cache:cacheName?option1=value1&option2=value2...

Offers both a Producer (to invoke cache operations on an Ignite cache) and a Consumer (to consume changes from a continuous query).

Options

OptionTypeDefault valueDescriptionCompulsoryConsumer/producer
operationIgniteCacheOperation enum---

Cache operation to perform.

Possible values: GET, PUT, REMOVE, SIZE, REBALANCE, QUERY, CLEAR.

NProducer
failIfInexistentCachebooleanfalseWhether to fail the initialization if the cache doesn't exist.NProducer
cachePeekModeCachePeekMode (Ignite) enumALLThe cache peek mode used for SIZE operations.NProducer
queryQuery---

The query used for QUERY operations (as a producer) or to launch the continuous query (as a consumer).

You can use a reference to a registry bean with a syntax like: ?query=#myQuery.

Y for the consumer

N for the producer

Producer (for QUERY operation) and Consumer
remoteFilterCacheEntryEventSerializableFilter

---

An optional remote filter for the continuous query consumer.

You can use a reference to a registry bean with a syntax like: ?remoteFilter=#myRemoteFilter.

NConsumer
oneExchangePerUpdatebooleantrueWhether to send one exchange per cache update, even if multiple changes arrive in a group.NConsumer
fireExistingQueryResultsbooleanfalseWhen starting the continuous query consumer, whether to fire existing cache results.NConsumer
autoUnsubscribeboolean

ContinuousQuery.DFLT_AUTO_UNSUBSCRIBE

Auto-unsubscribe flag on the Continuous Query (see Ignite docs).NConsumer
pageSizeint

ContinuousQuery.DFLT_PAGE_SIZE

Page size on the Continuous Query (see Ignite docs).NConsumer
timeIntervallong

ContinuousQuery.DFLT_TIME_INTERVAL

Time interval in millis on the Continuous Query (see Ignite docs).NConsumer

Ignite Compute endpoint

This endpoint allows you to run compute operations on the cluster by passing in an IgniteCallable, an IgniteRunnable, an IgniteClosure, or collections of them, along with their parameters if necessary. 

ignite:compute:endpointId?option1=value1&option2=value2...

This endpoint only supports producers.

Headers used

Header nameConstantExpected typeDescription

CamelIgniteComputeExecutionType

IgniteConstants.IGNITE_COMPUTE_EXECUTION_TYPEIgniteComputeExecutionType enumAllows you to dynamically change the compute operation to perform.

CamelIgniteComputeParameters 

IgniteConstants.IGNITE_COMPUTE_PARAMSAny object or Collection of objects.Parameters for APPLY, BROADCAST and EXECUTE operations.

CamelIgniteComputeReducer

IgniteConstants.IGNITE_COMPUTE_REDUCERIgniteReducerReducer for the APPLY and CALL operations.
CamelIgniteComputeAffinityCacheNameIgniteConstants.IGNITE_COMPUTE_AFFINITY_CACHE_NAMEStringAffinity cache name for the AFFINITY_CALL and AFFINITY_RUN operations.

CamelIgniteComputeAffinityKey

IgniteConstants.IGNITE_COMPUTE_AFFINITY_KEYObjectAffinity key for the AFFINITY_CALL and AFFINITY_RUN operations.

Allowable payload types

OperationExpected payloads
CALL
Collection of IgniteCallable, or a single IgniteCallable.
BROADCAST
IgniteCallable, IgniteRunnable, IgniteClosure.
APPLY
IgniteClosure.
EXECUTE
ComputeTask, Class<? extends ComputeTask> or an object representing parameters if the taskName option is not null.
RUN
A Collection of IgniteRunnables, or a single IgniteRunnable.
AFFINITY_CALL
IgniteCallable.
AFFINITY_RUN
IgniteRunnable.

Options

OptionTypeDefault valueDescriptionCompulsoryConsumer/producer

executionType

IgniteComputeExecutionType enum

---

The compute operation to perform.

Possible values: CALL, BROADCAST, APPLY, EXECUTE, RUN, AFFINITY_CALL, AFFINITY_RUN.

YProducer

clusterGroupExpression

ClusterGroupExpression
---

An expression that returns the Cluster Group for the IgniteCompute instance.

NProducer

taskName

String
---The task name, only used when performing the EXECUTE if a ComputeTask is not passed in the payload.NProducer

computeName

String
---

The name for the IgniteCompute instances produced by this endpoint.

N

Producer

timeoutMillis

Long

---

The timeout for the compute job.

NProducer

Options

Ignite Messaging endpoint

ignite:messaging:topicName?option1=value1&option2=value2...

Options

Ignite Events endpoint

ignite:events:endpointId?option1=value1&option2=value2...

Options

Ignite Sets endpoint

ignite:sets:setName?option1=value1&option2=value2...

Options

Ignite Queue endpoint

ignite:queue:queueName?option1=value1&option2=value2...

Options

Ignite ID Generator endpoint

ignite:idgen:sequenceName?option1=value1&option2=value2...

Options

Initializing the Ignite component

Each instance of the Ignite component is associated with an underlying org.apache.ignite.Ignite instance. You can interact with two Ignite clusters by initializing two instances of the Ignite component and binding them to different IgniteConfigurations. There are 3 ways to initialize the Ignite component:

  • By passing in an existing org.apache.ignite.Ignite instance. Here's an example using Spring config:
<bean name="ignite" class="org.apache.camel.component.ignite.IgniteComponent">
   <property name="ignite" ref="ignite" />
</bean>
  • By passing in an IgniteConfiguration, either constructed programmatically or through inversion of control (e.g. Spring, Blueprint, etc.). Here's an example using Spring config:
<bean name="ignite" class="org.apache.camel.component.ignite.IgniteComponent">
   <property name="igniteConfiguration">
      <bean class="org.apache.ignite.configuration.IgniteConfiguration">
         [...]
      </bean>
   </property>
</bean>
  • By passing in a URL, InputStream or String URL to a Spring-based configuration file. In all three cases, you inject them in the same property called configurationResource. Here's an example using Spring config:
<bean name="ignite" class="org.apache.camel.component.ignite.IgniteComponent">
   <property name="configurationResource" value="file:[...]/ignite-config.xml" />
</bean>


Additionally, if using Camel programmatically, there are several convenience static methods in IgniteComponent that return a component out of any of these configuration options:

  • IgniteComponent#fromIgnite(Ignite)
  • IgniteComponent#fromConfiguration(IgniteConfiguration)
  • IgniteComponent#fromInputStream(InputStream)
  • IgniteComponent#fromUrl(URL)
  • IgniteComponent#fromLocation(String)

General options

All endpoints share the following options:

OptionTypeDefault valueDescription
propagateIncomingBodyIfNoReturnValuebooleantrue 
treatCollectionsAsCacheObjectsbooleanfalse 

 

  • No labels