Camel Spring Boot

Infinispan

Read and write the entries of caches on a remote Infinispan server with the Hot Rod client, and receive their events.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-infinispan-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 30 options, which are listed below.

Name Description Default Type

camel.component.infinispan.autowired-enabled

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

camel.component.infinispan.bridge-error-handler

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

camel.component.infinispan.cache-container

To use a custom org.infinispan.client.hotrod.RemoteCacheManager. When set or autowired, Camel does not create a RemoteCacheManager, so the hosts, secure, username, password, saslMechanism, securityRealm, securityServerName, cacheContainerConfiguration, configurationUri and configurationProperties options are not used, and Camel does not stop it. The option is a org.infinispan.client.hotrod.RemoteCacheManager type.

RemoteCacheManager

camel.component.infinispan.cache-container-configuration

The org.infinispan.client.hotrod.configuration.Configuration of the RemoteCacheManager that Camel creates when cacheContainer is not set. When set, the hosts, secure, username, password, saslMechanism, securityRealm, securityServerName, configurationUri and configurationProperties options are not used. The option is a org.infinispan.client.hotrod.configuration.Configuration type.

Configuration

camel.component.infinispan.configuration

The configuration of the component, which each endpoint copies and then changes with its own options. The option is a org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration type.

InfinispanRemoteConfiguration

camel.component.infinispan.configuration-properties

Hot Rod client configuration properties for the RemoteCacheManager that Camel creates, for example socket_timeout=15000. The prefix infinispan.client.hotrod. is added to a key that does not have it. They take precedence over the properties of the configurationUri file. Not used when cacheContainer or cacheContainerConfiguration is set.

String>

camel.component.infinispan.configuration-uri

The location of the configuration file of the cache manager that Camel creates, read from the classpath unless it has a prefix such as file:. Not used when cacheContainer or cacheContainerConfiguration is set. For infinispan-embedded it is an Infinispan XML configuration file, read on the component only; for infinispan it is a Hot Rod client properties file.

String

camel.component.infinispan.custom-listener

To use a custom listener, a subclass of org.apache.camel.component.infinispan.remote.InfinispanRemoteCustomListener annotated with the Hot Rod ClientListener annotation, that the consumer registers on the cache in place of its own listener. The eventTypes option is not used then. Not used when queryBuilder is set. The option is a org.apache.camel.component.infinispan.remote.InfinispanRemoteCustomListener type.

InfinispanRemoteCustomListener

camel.component.infinispan.embedding-store-dimension

The number of dimensions of the vector embeddings, which must be equal to the dimension of the embedding model that creates them. It is used in the schema and the default embeddingStoreTypeName. Required, and greater than 0, when the embedding store is enabled.

Integer

camel.component.infinispan.embedding-store-distance

The k of the kNN query of the embedding store: the number of nearest embeddings that the QUERY operation returns for the vector query of the infinispan:embeddings transformer.

3

Integer

camel.component.infinispan.embedding-store-enabled

Whether to set up the embedding store, which stores the vector embeddings of camel-langchain4j-embeddings in the cache and searches them with a kNN query. Camel then requires embeddingStoreDimension, sets the ProtoStream marshaller of the embedding type on the RemoteCacheManager that it creates, and registers the schema of the embedding type (see embeddingStoreRegisterSchema). Only takes effect when camel-langchain4j-embeddings is on the classpath.

true

Boolean

camel.component.infinispan.embedding-store-register-schema

Whether Camel registers the Protobuf schema of the embedding type on the Infinispan server when it starts. Set it to false when the schema is already registered. Only used when the embedding store is enabled.

true

Boolean

camel.component.infinispan.embedding-store-schema-registration-timeout

How long Camel retries, once a second, to register the schema of the embedding type while the Infinispan server is not ready, for example when Camel and the server start at the same time. Camel fails to start when the time runs out.

60000ms

Duration

camel.component.infinispan.embedding-store-type-name

The name of the Protobuf message type of the embeddings, which the schema, the marshaller and the kNN query use. If not set, it is CamelInfinispanRemoteEmbedding followed by the embeddingStoreDimension, for example CamelInfinispanRemoteEmbedding384.

String

camel.component.infinispan.embedding-store-vector-similarity

The similarity function of the vector field in the schema of the embedding type, which the kNN query uses to compare the embeddings.

cosine

VectorSimilarity

camel.component.infinispan.enabled

Whether to enable auto configuration of the infinispan component. This is enabled by default.

Boolean

camel.component.infinispan.event-types

The comma-separated names of the Hot Rod client event types that the consumer passes on to the route: CLIENT_CACHE_ENTRY_CREATED, CLIENT_CACHE_ENTRY_MODIFIED, CLIENT_CACHE_ENTRY_REMOVED, CLIENT_CACHE_ENTRY_EXPIRED and CLIENT_CACHE_FAILOVER. If not set, the consumer passes on all of them. Not used when customListener or queryBuilder is set.

String

camel.component.infinispan.flags

A comma-separated list of names of org.infinispan.client.hotrod.Flag, for example FORCE_RETURN_VALUE, that the endpoint applies to each cache that it uses.

String

camel.component.infinispan.hosts

The Hot Rod servers to connect to, as host or host:port separated by semicolons, for example server1:11222;server2:11222. The port defaults to 11222. Required unless cacheContainer or cacheContainerConfiguration is set, and not used then.

String

camel.component.infinispan.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.infinispan.operation

The operation that the producer performs. The CamelInfinispanOperation header replaces this option.

put

InfinispanOperation

camel.component.infinispan.password

The password to authenticate with the Infinispan server. Only used when secure is true.

String

camel.component.infinispan.query-builder

To use a custom org.apache.camel.component.infinispan.InfinispanQueryBuilder that builds the query of the QUERY operation of the producer, which the CamelInfinispanQueryBuilder header replaces. When set, the consumer registers a continuous query instead of a listener, and receives the CacheEntryJoining, CacheEntryUpdated and CacheEntryLeaving events of the entries that match the query. The option is a org.apache.camel.component.infinispan.InfinispanQueryBuilder type.

InfinispanQueryBuilder

camel.component.infinispan.remapping-function

The java.util.function.BiFunction that the COMPUTE and COMPUTEASYNC operations call with the key and the current value of the entry, or null if there is none, to compute its new value. If the function returns null, the entry is removed. The option is a java.util.function.BiFunction type.

BiFunction

camel.component.infinispan.result-header

The name of the header in which the producer stores the result of the operation, keeping the message body. If not set, the result replaces the message body. The CamelInfinispanOperationResultHeader header replaces this option.

String

camel.component.infinispan.sasl-mechanism

The SASL mechanism of the authentication, for example SCRAM-SHA-512. If not set, the Hot Rod client uses SCRAM-SHA-256. Only used when secure is true.

String

camel.component.infinispan.secure

Whether the Hot Rod client authenticates with the Infinispan server, with the username and password options, which are then required, and the saslMechanism, securityRealm and securityServerName options. Not used when cacheContainer or cacheContainerConfiguration is set.

false

Boolean

camel.component.infinispan.security-realm

The name of the security realm of the user. If not set, the Hot Rod client uses default. Only used when secure is true.

String

camel.component.infinispan.security-server-name

The server name of the SASL authentication. If not set, the Hot Rod client uses infinispan. Only used when secure is true.

String

camel.component.infinispan.username

The username to authenticate with the Infinispan server. Only used when secure is true.

String