This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit b334a5ed1e948ca77daaab22b271cf9d1d148e1f Author: Luca Burgazzoli <lburgazz...@gmail.com> AuthorDate: Mon Jan 25 11:03:51 2021 +0100 CAMEL-12489 - camel-infinspan: split remote and embedded components (fix findings) --- .../camel/catalog/docs/infinispan-component.adoc | 495 ++++++++++++ .../docs/infinispan-embedded-component.adoc | 843 +++++++++++++++++++++ .../component/infinispan/InfinispanConsumer.java | 6 +- .../remote/InfinispanRemoteProducerTest.java | 2 +- .../remote/InfinispanRemoteTestSupport.java | 6 +- ...inispanRemoteIdempotentRepositoryCamelTest.java | 4 +- ...nispanRemoteIdempotentRepositorySpringTest.java | 1 + ...ispanRemoteIdempotentRepositoryTestSupport.java | 3 +- .../camel/maven/packaging/PrepareCatalogMojo.java | 113 +-- 9 files changed, 1410 insertions(+), 63 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc new file mode 100644 index 0000000..0ba396c --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc @@ -0,0 +1,495 @@ +[[infinispan-component]] += Infinispan Component +:docTitle: Infinispan +:artifactId: camel-infinispan +:description: Read and write from/to Infinispan distributed key/value store and data grid. +:since: 2.13 +:supportLevel: Stable +:component-header: Both producer and consumer are supported +include::{cq-version}@camel-quarkus:ROOT:partial$reference/components/infinispan.adoc[opts=optional] + +*Since Camel {since}* + +*{component-header}* + +This component allows you to interact with http://infinispan.org/[Infinispan] distributed data grid / cache using the Hot Rod procol. +Infinispan is an extremely scalable, highly available key/value data store and data grid platform written in Java. + +Infinispan requires at least Java 8. + +If you use Maven, you must add the following dependency to your `pom.xml`: + +[source,xml] +------------------------------------------------------------ +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-infinispan</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +------------------------------------------------------------ + +== URI format + +[source,java] +------------------------------- +infinispan://cacheName?[options] +------------------------------- + +== URI Options + +The producer allows sending messages to a remote cache using the HotRod protocol. +The consumer allows listening for events from a remote cache using the HotRod protocol. + +// component options: START +The Infinispan component supports 26 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *configuration* (common) | Component configuration | | InfinispanRemoteConfiguration +| *hosts* (common) | Specifies the host of the cache on Infinispan instance | | String +| *queryBuilder* (common) | Specifies the query builder. | | InfinispanQueryBuilder +| *secure* (common) | Define if we are connecting to a secured Infinispan instance | false | boolean +| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. 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 +| *customListener* (consumer) | Returns the custom listener in use, if provided | | InfinispanRemoteCustomListener +| *eventTypes* (consumer) | Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CLIENT_CACHE_ENTRY_CREATED, CLIENT_CACHE_ENTRY_MODIFIED, CLIENT_CACHE_ENTRY_REMOVED, CLIENT_CACHE_ENTRY_EXPIRED, CLIENT_CACHE_FAILOVER | | String +| *defaultValue* (producer) | Set a specific default value for some producer operations | | Object +| *key* (producer) | Set a specific key for producer operations | | Object +| *lazyStartProducer* (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 [...] +| *oldValue* (producer) | Set a specific old value for some producer operations | | Object +| *operation* (producer) | The operation to perform. There are 21 enums and the value can be one of: PUT, PUTASYNC, PUTALL, PUTALLASYNC, PUTIFABSENT, PUTIFABSENTASYNC, GET, GETORDEFAULT, CONTAINSKEY, CONTAINSVALUE, REMOVE, REMOVEASYNC, REPLACE, REPLACEASYNC, SIZE, CLEAR, CLEARASYNC, QUERY, STATS, COMPUTE, COMPUTEASYNC | PUT | InfinispanOperation +| *value* (producer) | Set a specific value for producer operations | | Object +| *password* ( security) | Define the password to access the infinispan instance | | String +| *saslMechanism* ( security) | Define the SASL Mechanism to access the infinispan instance | | String +| *securityRealm* ( security) | Define the security realm to access the infinispan instance | | String +| *securityServerName* ( security) | Define the security server name to access the infinispan instance | | String +| *username* ( security) | Define the username to access the infinispan instance | | String +| *autowiredEnabled* (advanced) | 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 +| *cacheContainer* (advanced) | *Autowired* Specifies the cache Container to connect | | RemoteCacheManager +| *cacheContainerConfiguration* (advanced) | *Autowired* The CacheContainer configuration. Uses if the cacheContainer is not defined. Must be the following types: org.infinispan.client.hotrod.configuration.Configuration - for remote cache interaction configuration; org.infinispan.configuration.cache.Configuration - for embedded cache interaction configuration; | | Configuration +| *configurationProperties* (advanced) | Implementation specific properties for the CacheManager | | Map +| *configurationUri* (advanced) | An implementation specific URI for the CacheManager | | String +| *flags* (advanced) | A comma separated list of Flag to be applied by default on each cache invocation, not applicable to remote caches. | | String +| *remappingFunction* (advanced) | Set a specific remappingFunction to use in a compute operation. | | BiFunction +| *resultHeader* (advanced) | Store the operation result in a header instead of the message body. By default, resultHeader == null and the query result is stored in the message body, any existing content in the message body is discarded. If resultHeader is set, the value is used as the name of the header to store the query result and the original message body is preserved. This value can be overridden by an in message header named: CamelInfinispanOperationResultHeader | | String +|=== +// component options: END + + + + +// endpoint options: START +The Infinispan endpoint is configured using URI syntax: + +---- +infinispan:cacheName +---- + +with the following path and query parameters: + +=== Path Parameters (1 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *cacheName* | *Required* The name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name. | | String +|=== + + +=== Query Parameters (26 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *hosts* (common) | Specifies the host of the cache on Infinispan instance | | String +| *queryBuilder* (common) | Specifies the query builder. | | InfinispanQueryBuilder +| *secure* (common) | Define if we are connecting to a secured Infinispan instance | false | boolean +| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. 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 +| *customListener* (consumer) | Returns the custom listener in use, if provided | | InfinispanRemoteCustomListener +| *eventTypes* (consumer) | Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CLIENT_CACHE_ENTRY_CREATED, CLIENT_CACHE_ENTRY_MODIFIED, CLIENT_CACHE_ENTRY_REMOVED, CLIENT_CACHE_ENTRY_EXPIRED, CLIENT_CACHE_FAILOVER | | String +| *exceptionHandler* (consumer) | 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 +| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern +| *defaultValue* (producer) | Set a specific default value for some producer operations | | Object +| *key* (producer) | Set a specific key for producer operations | | Object +| *lazyStartProducer* (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 [...] +| *oldValue* (producer) | Set a specific old value for some producer operations | | Object +| *operation* (producer) | The operation to perform. There are 21 enums and the value can be one of: PUT, PUTASYNC, PUTALL, PUTALLASYNC, PUTIFABSENT, PUTIFABSENTASYNC, GET, GETORDEFAULT, CONTAINSKEY, CONTAINSVALUE, REMOVE, REMOVEASYNC, REPLACE, REPLACEASYNC, SIZE, CLEAR, CLEARASYNC, QUERY, STATS, COMPUTE, COMPUTEASYNC | PUT | InfinispanOperation +| *value* (producer) | Set a specific value for producer operations | | Object +| *password* ( security) | Define the password to access the infinispan instance | | String +| *saslMechanism* ( security) | Define the SASL Mechanism to access the infinispan instance | | String +| *securityRealm* ( security) | Define the security realm to access the infinispan instance | | String +| *securityServerName* ( security) | Define the security server name to access the infinispan instance | | String +| *username* ( security) | Define the username to access the infinispan instance | | String +| *cacheContainer* (advanced) | *Autowired* Specifies the cache Container to connect | | RemoteCacheManager +| *cacheContainerConfiguration* (advanced) | *Autowired* The CacheContainer configuration. Uses if the cacheContainer is not defined. Must be the following types: org.infinispan.client.hotrod.configuration.Configuration - for remote cache interaction configuration; org.infinispan.configuration.cache.Configuration - for embedded cache interaction configuration; | | Configuration +| *configurationProperties* (advanced) | Implementation specific properties for the CacheManager | | Map +| *configurationUri* (advanced) | An implementation specific URI for the CacheManager | | String +| *flags* (advanced) | A comma separated list of Flag to be applied by default on each cache invocation, not applicable to remote caches. | | String +| *remappingFunction* (advanced) | Set a specific remappingFunction to use in a compute operation. | | BiFunction +| *resultHeader* (advanced) | Store the operation result in a header instead of the message body. By default, resultHeader == null and the query result is stored in the message body, any existing content in the message body is discarded. If resultHeader is set, the value is used as the name of the header to store the query result and the original message body is preserved. This value can be overridden by an in message header named: CamelInfinispanOperationResultHeader | | String +|=== +// endpoint options: END + +== Camel Operations +This section lists all available operations, along with their header information. + +.Put Operations +[cols="40%,60%a", frame="all", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.PUT | Puts a key/value pair in the cache, optionally with expiration +| InfinispanOperation.PUTASYNC | Asynchronously puts a key/value pair in the cache, optionally with expiration +| InfinispanOperation.PUTIFABSENT | Puts a key/value pair in the cache if it did not exist, optionally with expiration +| InfinispanOperation.PUTIFABSENTASYNC | Asynchronously puts a key/value pair in the cache if it did not exist, optionally with expiration +|=== + +* *Required Headers*: +** CamelInfinispanKey +** CamelInfinispanValue +* *Optional Headers*: +** CamelInfinispanLifespanTime +** CamelInfinispanLifespanTimeUnit +** CamelInfinispanMaxIdleTime +** CamelInfinispanMaxIdleTimeUnit +* *Result Header*: +** CamelInfinispanOperationResult + +.Put All Operations +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.PUTALL | Adds multiple entries to a cache, optionally with expiration +| CamelInfinispanOperation.PUTALLASYNC | Asynchronously adds multiple entries to a cache, optionally with expiration +|=== + +* *Required Headers*: +** CamelInfinispanMap +* *Optional Headers*: +** CamelInfinispanLifespanTime +** CamelInfinispanLifespanTimeUnit +** CamelInfinispanMaxIdleTime +** CamelInfinispanMaxIdleTimeUnit + +.Get Operations +[cols="40%,60%a", frame="all", options="header"] +|=== +|Operation Name |Description +| InfinispanOperation.GET | Retrieves the value associated with a specific key from the cache +| InfinispanOperation.GETORDEFAULT | Retrieves the value, or default value, associated with a specific key from the cache +|=== + +* *Required Headers*: +** CamelInfinispanKey + +.Contains Key Operation +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.CONTAINSKEY | Determines whether a cache contains a specific key +|=== + +* *Required Headers* +** CamelInfinispanKey +* *Result Header* +** CamelInfinispanOperationResult + +.Contains Value Operation +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.CONTAINSVALUE | Determines whether a cache contains a specific value +|=== + +* *Required Headers*: +** CamelInfinispanKey + + +.Remove Operations +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.REMOVE | Removes an entry from a cache, optionally only if the value matches a given one +| InfinispanOperation.REMOVEASYNC | Asynchronously removes an entry from a cache, optionally only if the value matches a given one +|=== + +* *Required Headers*: +** CamelInfinispanKey +* *Optional Headers*: +** CamelInfinispanValue +* *Result Header*: +** CamelInfinispanOperationResult + +.Replace Operations +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.REPLACE | Conditionally replaces an entry in the cache, optionally with expiration +| InfinispanOperation.REPLACEASYNC | Asynchronously conditionally replaces an entry in the cache, optionally with expiration +|=== + +* *Required Headers*: +** CamelInfinispanKey +** CamelInfinispanValue +** CamelInfinispanOldValue +* *Optional Headers*: +** CamelInfinispanLifespanTime +** CamelInfinispanLifespanTimeUnit +** CamelInfinispanMaxIdleTime +** CamelInfinispanMaxIdleTimeUnit +* *Result Header*: +** CamelInfinispanOperationResult + +.Clear Operations +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.CLEAR | Clears the cache +| InfinispanOperation.CLEARASYNC | Asynchronously clears the cache +|=== + +.Size Operation +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.SIZE | Returns the number of entries in the cache +|=== + +* *Result Header* +** CamelInfinispanOperationResult + +.Stats Operation +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.STATS | Returns statistics about the cache +|=== + +* *Result Header*: +** CamelInfinispanOperationResult + +.Query Operation +[cols="40%,60%a", options="header"] +|=== +| Operation Name | Description +| InfinispanOperation.QUERY | Executes a query on the cache +|=== + +* *Required Headers*: +** CamelInfinispanQueryBuilder +* *Result Header*: +** CamelInfinispanOperationResult + +[NOTE] +==== +Write methods like put(key, value) and remove(key) do not return the previous value by default. +==== + +== Message Headers + +[width="100%",cols="10%,10%,10%,10%,60%",options="header",] +|======================================================================= +|Name |Default Value |Type |Context |Description +|CamelInfinispanCacheName |`null` |String |Shared |The cache participating in the operation or event. +|CamelInfinispanOperation |`PUT` |InfinispanOperation |Producer |The operation to perform. +|CamelInfinispanMap |`null` |Map |Producer |A Map to use in case of CamelInfinispanOperationPutAll operation +|CamelInfinispanKey |`null` |Object |Shared |The key to perform the operation to or the key generating the event. +|CamelInfinispanValue |`null` |Object |Producer |The value to use for the operation. +|CamelInfinispanEventType |`null` |String |Consumer |The type of the received event. +|CamelInfinispanLifespanTime |`null` |long |Producer |The Lifespan time of a value inside the cache. Negative values are interpreted as infinity. +|CamelInfinispanTimeUnit |`null` |String |Producer |The Time Unit of an entry Lifespan Time. +|CamelInfinispanMaxIdleTime |`null` |long |Producer |The maximum amount of time an entry is allowed to be idle for before it is considered as expired. +|CamelInfinispanMaxIdleTimeUnit |`null` |String |Producer |The Time Unit of an entry Max Idle Time. +|CamelInfinispanQueryBuilder |null |InfinispanQueryBuilder |Producer |The QueryBuilde to use for QUERY command, if not present the command defaults to InifinispanConfiguration's one +|CamelInfinispanOperationResultHeader |null |String |Producer |Store the operation result in a header instead of the message body +|======================================================================= + + +== Examples + +* Put a key/value into a named cache: ++ +[source,java] +---- +from("direct:start") + .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.PUT) // <1> + .setHeader(InfinispanConstants.KEY).constant("123") // <2> + .to("infinispan:myCacheName&cacheContainer=#cacheContainer"); // <3> +---- +<1> Set the operation to perform +<2> Set the key used to identify the element in the cache +<3> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` ++ +It is possible to configure the lifetime and/or the idle time before the entry expires and gets evicted from the cache, as example: ++ +[source,java,options="nowrap"] +---- +from("direct:start") + .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.GET) + .setHeader(InfinispanConstants.KEY).constant("123") + .setHeader(InfinispanConstants.LIFESPAN_TIME).constant(100L) // <1> + .setHeader(InfinispanConstants.LIFESPAN_TIME_UNIT.constant(TimeUnit.MILLISECONDS.toString()) // <2> + .to("infinispan:myCacheName"); +---- +<1> Set the lifespan of the entry +<2> Set the time unit for the lifespan + +* Queries ++ +[source,java,options="nowrap"] +---- +from("direct:start") + .setHeader(InfinispanConstants.OPERATION, InfinispanConstants.QUERY) + .setHeader(InfinispanConstants.QUERY_BUILDER, new InfinispanQueryBuilder() { + @Override + public Query build(QueryFactory<Query> qf) { + return qf.from(User.class).having("name").like("%abc%").build(); + } + }) + .to("infinispan:myCacheName?cacheContainer=#cacheManager") ; +---- ++ + +[NOTE] +==== +The .proto descriptors for domain objects must be registered with the remote Data Grid server, see https://infinispan.org/docs/stable/titles/developing/developing.html#remote_query_example[Remote Query Example] in the official Infinispan documentation. +==== + +* Custom Listeners ++ +[source,java,options="nowrap"] +---- +from("infinispan://?cacheContainer=#cacheManager&customListener=#myCustomListener") + .to("mock:result"); +---- ++ +The instance of `myCustomListener` must exist and Camel should be able to look it up from the `Registry`. +Users are encouraged to extend the `org.apache.camel.component.infinispan.remote.InfinispanRemoteCustomListener` class and annotate the resulting class with `@ClientListener` which can be found found in package `org.infinispan.client.hotrod.annotation`. + + +== Using the Infinispan based idempotent repository + +In this section we will use the Infinispan based idempotent repository. + +.Java Example +[source,java] +---- +InfinispanRemoteConfiguration conf = new InfinispanRemoteConfiguration(); // <1> +conf.setHosts("localhost:1122") + +InfinispanRemoteIdempotentRepository repo = new InfinispanRemoteIdempotentRepository("idempotent"); // <2> +repo.setConfiguration(conf); + +context.addRoutes(new RouteBuilder() { + @Override + public void configure() { + from("direct:start") + .idempotentConsumer(header("MessageID"), repo) // <3> + .to("mock:result"); + } +}); +---- +<1> Configure the cache +<2> Configure the repository bean +<3> Set the repository to the route + +.XML Example +[source,xml] +---- +<bean id="infinispanRepo" class="org.apache.camel.component.infinispan.remote.InfinispanRemoteIdempotentRepository" destroy-method="stop"> + <constructor-arg value="idempotent"/> <1> + <property name="configuration"> <2> + <bean class="org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration"> + <property name="hosts" value="localhost:11222"/> + </bean> + </property> +</bean> + +<camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:start" /> + <idempotentConsumer messageIdRepositoryRef="infinispanRepo"> <3> + <header>MessageID</header> + <to uri="mock:result" /> + </idempotentConsumer> + </route> +</camelContext> +---- +<1> Set the name of the cache that will be used by the repository +<2> Configure the repository bean +<3> Set the repository to the route + +== Using the Infinispan based aggregation repository + +In this section we will use the Infinispan based aggregation repository. + +.Java Example +[source,java] +---- +InfinispanRemoteConfiguration conf = new InfinispanRemoteConfiguration(); // <1> +conf.setHosts("localhost:1122") + +InfinispanRemoteAggregationRepository repo = new InfinispanRemoteAggregationRepository(); // <2> +repo.setCacheName("aggregation"); +repo.setConfiguration(conf); + +context.addRoutes(new RouteBuilder() { + @Override + public void configure() { + from("direct:start") + .aggregate(header("MessageID")) + .completionSize(3) + .aggregationRepository(repo) // <3> + .aggregationStrategyRef("myStrategy") + .to("mock:result"); + } +}); +---- +<1> Configure the cache +<2> Create the repository bean +<3> Set the repository to the route + +.XML Example +[source,xml] +---- +<bean id="infinispanRepo" class="org.apache.camel.component.infinispan.remote.InfinispanRemoteAggregationRepository" destroy-method="stop"> + <constructor-arg value="aggregation"/> <1> + <property name="configuration"> <2> + <bean class="org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration"> + <property name="hosts" value="localhost:11222"/> + </bean> + </property> +</bean> + +<camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:start" /> + <aggregate strategyRef="myStrategy" + completionSize="3" + aggregationRepositoryRef="infinispanRepo"> <3> + <correlationExpression> + <header>MessageID</header> + </correlationExpression> + <to uri="mock:result"/> + </aggregate> + </route> +</camelContext> +---- +<1> Set the name of the cache that will be used by the repository +<2> Configure the repository bean +<3> Set the repository to the route + +[NOTE] +==== +With the release of Infinispan 11, it is required to set the encoding configuration on any cache created. This is critical for consuming events too. +For more information have a look at https://infinispan.org/docs/stable/titles/developing/developing.html#data_encoding[Data Encoding and MediaTypes] in the official Infinispan documentation. +==== + + + + +include::camel-spring-boot::page$infinispan-starter.adoc[] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc new file mode 100644 index 0000000..3b2f7f3 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc @@ -0,0 +1,843 @@ +[[infinispan-embedded-component]] += Infinispan Embedded Component +:docTitle: Infinispan Embedded +:artifactId: camel-infinispan-embedded +:description: Read and write from/to Infinispan distributed key/value store and data grid. +:since: 2.13 +:supportLevel: Stable +:component-header: Both producer and consumer are supported +include::{cq-version}@camel-quarkus:ROOT:partial$reference/components/infinispan-embedded.adoc[opts=optional] + +*Since Camel {since}* + +*{component-header}* + +This component allows you to interact with +http://infinispan.org/[Infinispan] distributed data grid / cache. +Infinispan is an extremely scalable, highly available key/value data +store and data grid platform written in Java. + +Infinispan requires at least Java 8. + +The `camel-infinispan` component includes the following features: + +* *Local Camel Consumer* - Receives cache change notifications and sends them to be processed. +This can be done synchronously or asynchronously, and is also supported with a replicated or distributed cache. + +* *Local Camel Producer* - A producer creates and sends messages to an endpoint. +The `camel-infinispan` producer uses ``GET``, ``PUT``, ``REMOVE``, and `CLEAR` operations. +The local producer is also supported with a replicated or distributed cache. + +The events are processed asynchronously. + +If you use Maven, you must add the following dependency to your `pom.xml`: + +[source,xml] +------------------------------------------------------------ +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-infinispan-embedded</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +------------------------------------------------------------ + +== URI format + +[source,java] +------------------------------- +infinispan-embedded://cacheName?[options] +------------------------------- + +== URI Options + +The producer allows sending messages to a local infinispan cache +configured in the registry, or to a remote cache using the HotRod +protocol. The consumer allows listening for events from local infinispan cache +accessible from the registry. + +If no cache configuration is provided, embedded cacheContainer is created directly in the component. + + +// component options: START +The Infinispan Embedded component supports 20 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *configuration* (common) | Component configuration | | InfinispanEmbeddedConfiguration +| *queryBuilder* (common) | Specifies the query builder. | | InfinispanQueryBuilder +| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. 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 +| *clusteredListener* (consumer) | If true, the listener will be installed for the entire cluster | false | boolean +| *customListener* (consumer) | Returns the custom listener in use, if provided | | InfinispanEmbeddedCustomListener +| *eventTypes* (consumer) | Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CACHE_ENTRY_ACTIVATED, CACHE_ENTRY_PASSIVATED, CACHE_ENTRY_VISITED, CACHE_ENTRY_LOADED, CACHE_ENTRY_EVICTED, CACHE_ENTRY_CREATED, CACHE_ENTRY_REMOVED, CACHE_ENTRY_MODIFIED, TRANSACTION_COMPLETED, TRANSACTION_REGISTERED, CACHE_ENTRY_INVALIDATED, CACHE_ENTRY_EXPIRED, DATA_REHASHED, TOPOLOGY_CHANGED, PARTITION_STATUS_CHANGED, PERSIS [...] +| *sync* (consumer) | If true, the consumer will receive notifications synchronously | true | boolean +| *defaultValue* (producer) | Set a specific default value for some producer operations | | Object +| *key* (producer) | Set a specific key for producer operations | | Object +| *lazyStartProducer* (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 [...] +| *oldValue* (producer) | Set a specific old value for some producer operations | | Object +| *operation* (producer) | The operation to perform. There are 21 enums and the value can be one of: PUT, PUTASYNC, PUTALL, PUTALLASYNC, PUTIFABSENT, PUTIFABSENTASYNC, GET, GETORDEFAULT, CONTAINSKEY, CONTAINSVALUE, REMOVE, REMOVEASYNC, REPLACE, REPLACEASYNC, SIZE, CLEAR, CLEARASYNC, QUERY, STATS, COMPUTE, COMPUTEASYNC | PUT | InfinispanOperation +| *value* (producer) | Set a specific value for producer operations | | Object +| *autowiredEnabled* (advanced) | 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 +| *cacheContainer* (advanced) | *Autowired* Specifies the cache Container to connect | | EmbeddedCacheManager +| *cacheContainerConfiguration* (advanced) | *Autowired* The CacheContainer configuration. Uses if the cacheContainer is not defined. Must be the following types: org.infinispan.client.hotrod.configuration.Configuration - for remote cache interaction configuration; org.infinispan.configuration.cache.Configuration - for embedded cache interaction configuration; | | Configuration +| *configurationUri* (advanced) | An implementation specific URI for the CacheManager | | String +| *flags* (advanced) | A comma separated list of Flag to be applied by default on each cache invocation, not applicable to remote caches. | | String +| *remappingFunction* (advanced) | Set a specific remappingFunction to use in a compute operation. | | BiFunction +| *resultHeader* (advanced) | Store the operation result in a header instead of the message body. By default, resultHeader == null and the query result is stored in the message body, any existing content in the message body is discarded. If resultHeader is set, the value is used as the name of the header to store the query result and the original message body is preserved. This value can be overridden by an in message header named: CamelInfinispanOperationResultHeader | | String +|=== +// component options: END + + + + +// endpoint options: START +The Infinispan Embedded endpoint is configured using URI syntax: + +---- +infinispan-embedded:cacheName +---- + +with the following path and query parameters: + +=== Path Parameters (1 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *cacheName* | *Required* The name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name. | | String +|=== + + +=== Query Parameters (20 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *queryBuilder* (common) | Specifies the query builder. | | InfinispanQueryBuilder +| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. 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 +| *clusteredListener* (consumer) | If true, the listener will be installed for the entire cluster | false | boolean +| *customListener* (consumer) | Returns the custom listener in use, if provided | | InfinispanEmbeddedCustomListener +| *eventTypes* (consumer) | Specifies the set of event types to register by the consumer.Multiple event can be separated by comma. The possible event types are: CACHE_ENTRY_ACTIVATED, CACHE_ENTRY_PASSIVATED, CACHE_ENTRY_VISITED, CACHE_ENTRY_LOADED, CACHE_ENTRY_EVICTED, CACHE_ENTRY_CREATED, CACHE_ENTRY_REMOVED, CACHE_ENTRY_MODIFIED, TRANSACTION_COMPLETED, TRANSACTION_REGISTERED, CACHE_ENTRY_INVALIDATED, CACHE_ENTRY_EXPIRED, DATA_REHASHED, TOPOLOGY_CHANGED, PARTITION_STATUS_CHANGED, PERSIS [...] +| *sync* (consumer) | If true, the consumer will receive notifications synchronously | true | boolean +| *exceptionHandler* (consumer) | 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 +| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern +| *defaultValue* (producer) | Set a specific default value for some producer operations | | Object +| *key* (producer) | Set a specific key for producer operations | | Object +| *lazyStartProducer* (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 [...] +| *oldValue* (producer) | Set a specific old value for some producer operations | | Object +| *operation* (producer) | The operation to perform. There are 21 enums and the value can be one of: PUT, PUTASYNC, PUTALL, PUTALLASYNC, PUTIFABSENT, PUTIFABSENTASYNC, GET, GETORDEFAULT, CONTAINSKEY, CONTAINSVALUE, REMOVE, REMOVEASYNC, REPLACE, REPLACEASYNC, SIZE, CLEAR, CLEARASYNC, QUERY, STATS, COMPUTE, COMPUTEASYNC | PUT | InfinispanOperation +| *value* (producer) | Set a specific value for producer operations | | Object +| *cacheContainer* (advanced) | *Autowired* Specifies the cache Container to connect | | EmbeddedCacheManager +| *cacheContainerConfiguration* (advanced) | *Autowired* The CacheContainer configuration. Uses if the cacheContainer is not defined. Must be the following types: org.infinispan.client.hotrod.configuration.Configuration - for remote cache interaction configuration; org.infinispan.configuration.cache.Configuration - for embedded cache interaction configuration; | | Configuration +| *configurationUri* (advanced) | An implementation specific URI for the CacheManager | | String +| *flags* (advanced) | A comma separated list of Flag to be applied by default on each cache invocation, not applicable to remote caches. | | String +| *remappingFunction* (advanced) | Set a specific remappingFunction to use in a compute operation. | | BiFunction +| *resultHeader* (advanced) | Store the operation result in a header instead of the message body. By default, resultHeader == null and the query result is stored in the message body, any existing content in the message body is discarded. If resultHeader is set, the value is used as the name of the header to store the query result and the original message body is preserved. This value can be overridden by an in message header named: CamelInfinispanOperationResultHeader | | String +|=== +// endpoint options: END + +== Camel Operations +This section lists all available operations, along with their header information. + +.Put Operations +[cols="40%,60%", frame="all", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.PUT +| *Context*: Embedded / Remote + +*Description*: Puts a key/value pair in the cache, optionally with expiration + +*Required Headers*: CamelInfinispanKey, CamelInfinispanValue + +*Optional Headers*: CamelInfinispanLifespanTime, CamelInfinispanLifespanTimeUnit, CamelInfinispanMaxIdleTime, CamelInfinispanMaxIdleTimeUnit, CamelInfinispanIgnoreReturnValues + +*Result Header*: CamelInfinispanOperationResult + +| InfinispanOperation.PUTASYNC +| *Description*: Asynchronously puts a key/value pair in the cache, optionally with expiration + + +| InfinispanOperation.PUTIFABSENT +| *Description*: Puts a key/value pair in the cache if it did not exist, optionally with expiration + + +| InfinispanOperation.PUTIFABSENTASYNC +| *Description*: Asynchronously puts a key/value pair in the cache if it did not exist, optionally with expiration + +|=== + +.Put All Operations +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.PUTALL +| *Context*: Embedded / Remote + +*Description*: Adds multiple entries to a cache, optionally with expiration + +*Required Headers*: CamelInfinispanMap + +*Optional Headers*: CamelInfinispanLifespanTime, CamelInfinispanLifespanTimeUnit, CamelInfinispanMaxIdleTime, CamelInfinispanMaxIdleTimeUnit + +*Result Header*: None + +| CamelInfinispanOperation.PUTALLASYNC +| *Description*: Asynchronously adds multiple entries to a cache, optionally with expiration + +|=== + +.Get Operations +[cols="40%,60%", frame="all", options="header"] +|=== +|Operation Name +|Description + +| InfinispanOperation.GET +| *Context*: Embedded / Remote + +*Description*: Retrieves the value associated with a specific key from the cache + +*Required Headers*: CamelInfinispanKey + +*Optional Headers*: None + +*Result Header*: None + +| InfinispanOperation.GETORDEFAULT +| *Context*: Embedded / Remote + +*Description*: Retrieves the value, or default value, associated with a specific key from the cache + +*Required Headers*: CamelInfinispanKey + +*Optional Headers*: None + +*Result Header*: None +|=== + +.Contains Key Operation +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.CONTAINSKEY +| *Context*: Embedded / Remote + +*Description*: Determines whether a cache contains a specific key + +*Required Headers*: CamelInfinispanKey + +*Optional Headers*: None + +*Result Header*: CamelInfinispanOperationResult +|=== + +.Contains Value Operation +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.CONTAINSVALUE +| *Context*: Embedded / Remote + +*Description*: Determines whether a cache contains a specific value + +*Required Headers*: CamelInfinispanKey + +*Optional Headers*: None + +*Result Headers*: None +|=== + +.Remove Operations +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.REMOVE +| *Context*: Embedded / Remote + +*Description*: Removes an entry from a cache, optionally only if the value matches a given one + +*Required Headers*: CamelInfinispanKey + +*Optional Headers*: CamelInfinispanValue + +*Result Header*: CamelInfinispanOperationResult + +| InfinispanOperation.REMOVEASYNC +| *Description*: Asynchronously removes an entry from a cache, optionally only if the value matches a given one + +|=== + +.Replace Operations +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.REPLACE +| *Context*: Embedded / Remote + +*Description*: Conditionally replaces an entry in the cache, optionally with expiration + +*Required Headers*: CamelInfinispanKey, CamelInfinispanValue, CamelInfinispanOldValue + +*Optional Headers*: CamelInfinispanLifespanTime, CamelInfinispanLifespanTimeUnit, CamelInfinispanMaxIdleTime, CamelInfinispanMaxIdleTimeUnit, CamelInfinispanIgnoreReturnValues + +*Result Header*: CamelInfinispanOperationResult + +| InfinispanOperation.REPLACEASYNC +| *Description*: Asynchronously conditionally replaces an entry in the cache, optionally with expiration + +|=== + +.Clear Operations +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.CLEAR +| *Context*: Embedded / Remote + +*Description*: Clears the cache + +*Required Headers*: None + +*Optional Headers*: None + +*Result Header*: None + +| InfinispanOperation.CLEARASYNC +| *Context*: Embedded / Remote + +*Description*: Asynchronously clears the cache + +*Required Headers*: None + +*Optional Headers*: None + +*Result Header*: None +|=== + +.Size Operation +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.SIZE +| *Context*: Embedded / Remote + +*Description*: Returns the number of entries in the cache + +*Required Headers*: None + +*Optional Headers*: None + +*Result Header*: CamelInfinispanOperationResult +|=== + +.Stats Operation +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.STATS +| *Context*: Embedded / Remote + +*Description*: Returns statistics about the cache + +*Required Headers*: None + +*Optional Headers*: None + +*Result Header*: CamelInfinispanOperationResult +|=== + +.Query Operation +[cols="40%,60%", options="header"] +|=== +| Operation Name +| Description + +| InfinispanOperation.QUERY +| *Context*: Remote + +*Description*: Executes a query on the cache + +*Required Headers*: CamelInfinispanQueryBuilder + +*Optional Headers*: None + +*Result Header*: CamelInfinispanOperationResult +|=== + +[NOTE] +==== +Any operations that take `CamelInfinispanIgnoreReturnValues` will receive a null result. +==== + + + +== Message Headers + +[width="100%",cols="10%,10%,10%,10%,60%",options="header",] +|======================================================================= +|Name |Default Value |Type |Context |Description +|CamelInfinispanCacheName |`null` |String |Shared |The cache participating in the operation or event. +|CamelInfinispanOperation |`PUT` |InfinispanOperation |Producer |The operation to perform. +|CamelInfinispanMap |`null` |Map |Producer |A Map to use in case of CamelInfinispanOperationPutAll operation +|CamelInfinispanKey |`null` |Object |Shared |The key to perform the operation to or the key generating the event. +|CamelInfinispanValue |`null` |Object |Producer |The value to use for the operation. +|CamelInfinispanEventType |`null` |String |Consumer |The type of the received event. Possible values defined here org.infinispan.notifications.cachelistener.event.Event.Type +|CamelInfinispanIsPre |`null` |Boolean |Consumer |Infinispan fires two events for each operation: one before and one after the operation. +|CamelInfinispanLifespanTime |`null` |long |Producer |The Lifespan time of a value inside the cache. Negative values are interpreted as infinity. +|CamelInfinispanTimeUnit |`null` |String |Producer |The Time Unit of an entry Lifespan Time. +|CamelInfinispanMaxIdleTime |`null` |long |Producer |The maximum amount of time an entry is allowed to be idle for before it is considered as expired. +|CamelInfinispanMaxIdleTimeUnit |`null` |String |Producer |The Time Unit of an entry Max Idle Time. +|CamelInfinispanQueryBuilder |null |InfinispanQueryBuilder |Producer |The QueryBuilde to use for QUERY command, if not present the command defaults to InifinispanConfiguration's one +|CamelInfinispanIgnoreReturnValues |null |Boolean |Producer |If this header is set, the return value for cache operation returning something is ignored by the client application +|CamelInfinispanOperationResultHeader |null |String |Producer |Store the operation result in a header instead of the message body +|======================================================================= + +== Examples + +* Retrieve a specific key from the default cache using a custom cache container: + +[source,java] +---- +from("direct:start") + .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.GET) + .setHeader(InfinispanConstants.KEY).constant("123") + .to("infinispan?cacheContainer=#cacheContainer"); +---- + + +* Put a key/value into a named cache: ++ +[source,java] +---- +from("direct:start") + .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.PUT) + .setHeader(InfinispanConstants.KEY).constant("123") + .to("infinispan:myCacheName"); +---- + +* Put a value with lifespan + +[source,java] +---- +from("direct:start") + .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.GET) + .setHeader(InfinispanConstants.KEY).constant("123") + .setHeader(InfinispanConstants.LIFESPAN_TIME).constant(100L) + .setHeader(InfinispanConstants.LIFESPAN_TIME_UNIT.constant(TimeUnit.MILLISECONDS.toString()) + .to("infinispan:myCacheName"); +---- + +* Compute operation through a remapping function on the default cache using a custom cache container: + +[source,java] +---- +@BindToRegistry("mappingFunction") +BiFunction<String, String, String> comp = (k, v) -> v + "replay"; + +from("direct:start") + .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.COMPUTE) + .setHeader(InfinispanConstants.KEY).constant("123") + .to("infinispan?cacheContainer=#cacheContainer&remappingFunction=#mappingFunction"); +---- + +This will return oldValue + "replay". + +This can be done also as async operation, with the `InfinispanOperation.COMPUTEASYNC` operation + +* Retrieve a specific key from the remote cache using a cache container configuration with additional parameters (host, port and protocol version): + +[source,java] +---- +org.infinispan.client.hotrod.configuration.Configuration cacheContainerConfiguration = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() + .addServer() + .host("localhost") + .port(9999) + .version(org.infinispan.client.hotrod.ProtocolVersion.PROTOCOL_VERSION_25) + .build(); +... + +from("direct:start") + .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.GET) + .setHeader(InfinispanConstants.KEY).constant("123") + .to("infinispan?cacheContainerConfiguration=#cacheContainerConfiguration"); +---- + + + +=== XML examples + +Routing can also be performed using XML configuration. +The following example demonstrates `camel-infinispan` `local-camel-producer`, a camel route that sends data to an embedded cache created by the `local-cache` module. + +[source,java,options="nowrap"] +---- +<camelContext id="local-producer" xmlns="http://camel.apache.org/schema/blueprint"> + <route> + <from uri="timer://local?fixedRate=true&period=5000"/> + <setHeader headerName="CamelInfinispanKey"> + <constant>CamelTimerCounter</constant> + </setHeader> + <setHeader headerName="CamelInfinispanValue"> + <constant>CamelTimerCounter</constant> + </setHeader> + <to uri="infinispan://foo?cacheContainer=#cacheManager"/> + <to uri="log:local-put?showAll=true"/> + </route> +</camelContext> +---- + + +The provided example requires you to instantiate the [class]``cacheManager``. + +You can instantiate the [class]``cacheManager`` bean for Spring XML as follows: + +[source,xml,options="nowrap"] +---- +<bean id="cacheManager" class="org.infinispan.manager.DefaultCacheManager" init-method="start" destroy-method="stop"> + <constructor-arg type="java.lang.String" value="infinispan.xml"/> +</bean> +---- + + +The following demonstrates how to instantiate the [class]``cacheManager`` bean using Blueprint XML. + +[source,xml,options="nowrap"] +---- +<bean id="cacheManager" class="org.infinispan.manager.DefaultCacheManager" init-method="start" destroy-method="stop"> + <argument value="infinispan.xml" /> +</bean> +---- + +[NOTE] +==== +Both the Spring XML and Blueprint XML examples use the configuration file [path]_infinispan.xml_ + for configuration of the cache. This file must be present on the classpath. +==== + + +== Remote Query + +When executing remote queries the cacheManager must be an instance of ``RemoteCacheManager``, and an example configuration utilizing a `RemoteCacheManager` is found below for both Java and blueprint.xml: + +.Using only Java +==== +[source,java,options="nowrap"] +---- +from("direct:start") + .setHeader(InfinispanConstants.OPERATION, InfinispanConstants.QUERY) + .setHeader(InfinispanConstants.QUERY_BUILDER, + new InfinispanQueryBuilder() { + public Query build(QueryFactory<Query> queryFactory) { + return queryFactory.from(User.class).having("name").like("%abc%") + .build(); + } + }) + .to("infinispan://localhost?cacheContainer=#cacheManager&cacheName=remote_query_cache") ; +---- +==== + +.Using Blueprint and Java +==== +.Java [class]``RemoteCacheManagerFactory`` class: +[source,java,options="nowrap"] +---- +public class RemoteCacheManagerFactory { + ConfigurationBuilder clientBuilder; + public RemoteCacheManagerFactory(String hostname, int port) { + clientBuilder = new ConfigurationBuilder(); + clientBuilder.addServer() + .host(hostname).port(port); + } + public RemoteCacheManager newRemoteCacheManager() { + return new RemoteCacheManager(clientBuilder.build()); + } +} +---- +.Java [class]``InfinispanQueryExample`` class: +[source,java,options="nowrap"] +---- +public class InfinispanQueryExample { + public InfinispanQueryBuilder getBuilder() { + return new InfinispanQueryBuilder() { + public Query build(QueryFactory<Query> queryFactory) { + return queryFactory.from(User.class) + .having("name") + .like("%abc%") + .build(); + } + } + } +} +---- +.blueprint.xml: +[source,xml,options="nowrap"] +---- +<bean id=”remoteCacheManagerFactory” class=“com.datagrid.RemoteCacheManagerFactory”> + <argument value=”localhost”/> + <argument value="11222”/> +</bean> + +<bean id=”cacheManager” + factory-ref=”remoteCacheManagerFactory” + factory-method=“newRemoteCacheManager”> +</bean> + +<bean id="queryBuilder" class="org.example.com.InfinispanQueryExample"/> + +<camelContext id="route" xmlns="http://camel.apache.org/schema/blueprint"> + <route> + <from uri="direct:start"/> + <setHeader headerName="CamelInfinispanOperation"> + <constant>CamelInfinispanOperationQuery</constant> + </setHeader> + <setHeader headerName="CamelInfinispanQueryBuilder"> + <method ref="queryBuilder" method="getBuilder"/> + </setHeader> + <to uri="infinispan://localhost?cacheContainer=#cacheManager&cacheName=remote_query_cache"/> + </route> +</camelContext> +---- +==== + +The `remote_query_cache` is an arbitrary name for a cache that holds the data, and the results of the query will be a list of domain objects stored as a `CamelInfinispanOperationResult` header. + +In addition, there are the following requirements: + +* The [class]``RemoteCacheManager`` must be configured to use [class]``ProtoStreamMarshaller``. +* The [class]``ProtoStreamMarshaller`` must be registered with the [class]``RemoteCacheManager``'s serialization context. +* The .proto descriptors for domain objects must be registered with the remote Data Grid server. + + +== Custom Listeners for Embedded Cache + +Custom Listeners for an embedded cache can be registered through the [parameter]``customListener`` parameter as shown below: + +.Using Java + +[source,java,options="nowrap"] +---- +from("infinispan://?cacheContainer=#myCustomContainer&cacheName=customCacheName&customListener=#myCustomListener") + .to("mock:result"); +---- + +.Using Blueprint + +[source,xml,options="nowrap"] +---- +<bean id="myCustomContainer" org.infinispan.manager.DefaultCacheManager" + init-method="start" destroy-method="stop"> + <argument value="infinispan.xml" /> +</bean> + +<bean id="myCustomListener" class="org.example.com.CustomListener"/> + +<camelContext id="route" xmlns="http://camel.apache.org/schema/blueprint"> + <route> + <from uri="infinispan://?cacheContainer=#myCustomContainer&cacheName=customCacheName&customListener=#myCustomListener"/> + <to uri="mock:result"/> + </route> +</camelContext> +---- + + +The instance of [class]``myCustomListener`` must exist. +Users are encouraged to extend the [class]``org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedCustomListener`` and annotate the resulting class with the `@Listener` annotation from [package]#org.infinispan.notifications# +. + +[NOTE] +==== +Custom filters and converters for embedded caches are currently not supported. +==== + + +== Custom Listeners for Remote Cache + +Custom listeners for a remote cache can be registered in the same way as an embedded cache, with the exception that [parameter]``sync=false`` must be present. +For instance: + +.Using only Java +==== +[source,java,options="nowrap"] +---- +from(infinispan://?cacheContainer=#cacheManager&sync=false&customListener=#myCustomListener") + .to(mock:result); +---- +==== + +.Using Blueprint and Java +==== +.Java class: +[source,java,options="nowrap"] +---- + +public class RemoteCacheManagerFactory { + ConfigurationBuilder clientBuilder; + public RemoteCacheManagerFactory(String hostname, int port) { + clientBuilder = new ConfigurationBuilder(); + clientBuilder.addServer() + .host(hostname).port(port); + } + public RemoteCacheManager newRemoteCacheManager() { + return new RemoteCacheManager(clientBuilder.build()); + } +} +---- +.blueprint.xml: +[source,xml,options="nowrap"] +---- +<bean id=”remoteCacheManagerFactory” class=“com.datagrid.RemoteCacheManagerFactory”> + <argument value=”localhost”/> + <argument value="11222”/> +</bean> + +<bean id=”cacheManager” + factory-ref=”remoteCacheManagerFactory” + factory-method=“newRemoteCacheManager”> +</bean> + +<bean id="myCustomListener" class="org.example.com.CustomListener"/> + +<camelContext id="route" xmlns="http://camel.apache.org/schema/blueprint"> + <route> + <from uri="infinispan://?cacheContainer=#cacheManager&sync=false&customListener=#myCustomListener"/> + <to uri="mock:result"/> + </route> +</camelContext> +---- +==== + +The instance of [class]``myCustomListener`` must exist. +Users are encouraged to extend the [class]``org.apache.camel.component.infinispan.remote.InfinispanRemoteCustomListener`` class and annotate the resulting class with ``@ClientListener``; this annotation is found in [package]#org.infinispan.client.hotrod.annotation# +. + +Remote listeners may also be associated with custom filters and converters as shown below: +[source,java,options="nowrap"] +---- +@ClientListener(includeCurrentState=true, filterFactoryName = "static-filter-factory", converterFactoryName = "static-converter-factory") + private static class MyCustomListener extends InfinispanRemoteCustomListener { +} +---- + +In order to use custom filters or converters classes annotated with `@NamedFactory` must be implemented. +A skeleton that implements the necessary methods is shown below: +[source,java,options="nowrap"] +---- +import org.infinispan.notifications.cachelistener.filter; + +@NamedFactory(name = "static-converter-factory") +public static class StaticConverterFactory implements CacheEventConverterFactory { + @Override + public CacheEventConverter<Integer, String, CustomEvent> getConverter(Object[] params) { + ... + } + + static class StaticConverter implements CacheEventConverter<Integer, String, CustomEvent>, Serializable { + @Override + public CustomEvent convert(Integer key, String previousValue, Metadata previousMetadata, + String value, Metadata metadata, EventType eventType) { + ... + } + } +} + +@NamedFactory(name = "static-filter-factory") +public static class StaticCacheEventFilterFactory implements CacheEventFilterFactory { + @Override + public CacheEventFilter<Integer, String> getFilter(final Object[] params) { + ... + } + + static class StaticCacheEventFilter implements CacheEventFilter<Integer, String>, Serializable { + @Override + public boolean accept(Integer key, String previousValue, Metadata previousMetadata, + String value, Metadata metadata, EventType eventType) { + ... + } + } +} +---- + +Custom filters and converters must be registered with the server. +. + +[NOTE] +==== +In order to listen for remote HotRod events the cacheManager must be of type [class]``RemoteCacheManager`` and instantiated. +==== + +[NOTE] +==== +With the release of Infinispan 11, it is required to set the encoding configuration on any cache created. This is critical for consuming events too. +For more information have a look at https://infinispan.org/docs/stable/titles/developing/developing.html#data_encoding[Data Encoding and MediaTypes] in the official Infinispan documentation. +==== + +== Using the Infinispan based idempotent repository + +In this section we will use the Infinispan based idempotent repository. + +First, we need to create a cacheManager and then configure our + +[source,java] +---- +org.apache.camel.component.infinispan.processor.idempotent.InfinispanIdempotentRepository: +---- + +[source,xml] +---- +<!-- set up the cache manager --> +<bean id="cacheManager" + class="org.infinispan.manager.DefaultCacheManager" + init-method="start" + destroy-method="stop"/> + +<!-- set up the repository --> +<bean id="infinispanRepo" + class="org.apache.camel.component.infinispan.InfinispanIdempotentRepository" + factory-method="infinispanIdempotentRepository"> + <argument ref="cacheManager"/> + <argument value="idempotent"/> +</bean> +---- + +Then we can create our Infinispan idempotent repository in the spring +XML file as well: + +[source,xml] +---- +<camelContext xmlns="http://camel.apache.org/schema/spring"> + <route id="JpaMessageIdRepositoryTest"> + <from uri="direct:start" /> + <idempotentConsumer messageIdRepositoryRef="infinispanStore"> + <header>messageId</header> + <to uri="mock:result" /> + </idempotentConsumer> + </route> +</camelContext> +---- + + +include::camel-spring-boot::page$infinispan-starter.adoc[] diff --git a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConsumer.java b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConsumer.java index 39f5f61..9c09afb 100644 --- a/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConsumer.java +++ b/components/camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanConsumer.java @@ -23,8 +23,6 @@ import org.apache.camel.Processor; import org.apache.camel.support.DefaultConsumer; import org.infinispan.commons.api.BasicCache; import org.infinispan.commons.api.BasicCacheContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public abstract class InfinispanConsumer< ContainerType extends BasicCacheContainer, @@ -33,8 +31,6 @@ public abstract class InfinispanConsumer< extends DefaultConsumer implements InfinispanEventProcessor { - private static final Logger LOG = LoggerFactory.getLogger(InfinispanProducer.class); - protected final ConfigurationType configuration; protected final ManagerType manager; protected final String cacheName; @@ -66,7 +62,7 @@ public abstract class InfinispanConsumer< try { getProcessor().process(exchange); } catch (Exception e) { - LOG.error("Error processing event ", e); + getExceptionHandler().handleException(e); } } diff --git a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteProducerTest.java b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteProducerTest.java index e0ac1eb..c14c00f 100644 --- a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteProducerTest.java +++ b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteProducerTest.java @@ -3,7 +3,7 @@ * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License", getCacheName()); you may not use this file except in compliance with + * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 diff --git a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteTestSupport.java b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteTestSupport.java index 75fc85b..e9563bd 100644 --- a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteTestSupport.java +++ b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteTestSupport.java @@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory; @TestMethodOrder(MethodOrderer.MethodName.class) public class InfinispanRemoteTestSupport extends InfinispanTestSupport { - protected RemoteCacheManager cacheContainer; - @RegisterExtension - static InfinispanService service = InfinispanServiceFactory.createService(); + public static InfinispanService service = InfinispanServiceFactory.createService(); + + protected RemoteCacheManager cacheContainer; @Override protected void setupResources() throws Exception { diff --git a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryCamelTest.java b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryCamelTest.java index f8fffe6..d47a550 100644 --- a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryCamelTest.java +++ b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryCamelTest.java @@ -21,7 +21,9 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.test.annotation.DirtiesContext; @DirtiesContext -public class SpringInfinispanRemoteIdempotentRepositoryCamelTest extends SpringInfinispanRemoteIdempotentRepositoryTestSupport { +public class SpringInfinispanRemoteIdempotentRepositoryCamelTest + extends SpringInfinispanRemoteIdempotentRepositoryTestSupport { + @Override protected AbstractApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext( diff --git a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositorySpringTest.java b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositorySpringTest.java index 93c8442..4726f42 100644 --- a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositorySpringTest.java +++ b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositorySpringTest.java @@ -23,6 +23,7 @@ import org.springframework.test.annotation.DirtiesContext; @DirtiesContext public class SpringInfinispanRemoteIdempotentRepositorySpringTest extends SpringInfinispanRemoteIdempotentRepositoryTestSupport { + @Override protected AbstractApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext( diff --git a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryTestSupport.java b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryTestSupport.java index 5c91175..28ba51d 100644 --- a/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryTestSupport.java +++ b/components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/spring/SpringInfinispanRemoteIdempotentRepositoryTestSupport.java @@ -33,9 +33,8 @@ import org.junit.jupiter.api.extension.RegisterExtension; import static org.junit.jupiter.api.Assertions.assertNotNull; public abstract class SpringInfinispanRemoteIdempotentRepositoryTestSupport extends CamelSpringTestSupport { - @RegisterExtension - static InfinispanService service = InfinispanServiceFactory.createService(); + public static InfinispanService service = InfinispanServiceFactory.createService(); @Override public void doPreSetup() throws Exception { diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java index e87145c..9432129 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java @@ -214,6 +214,25 @@ public class PrepareCatalogMojo extends AbstractMojo { private Collection<Path> allPropertiesFiles; private Map<Path, BaseModel<?>> allModels; + private static String asComponentName(Path file) { + String name = file.getFileName().toString(); + if (name.endsWith(PackageHelper.JSON_SUFIX)) { + return name.substring(0, name.length() - PackageHelper.JSON_SUFIX.length()); + } else if (name.endsWith(".adoc")) { + return name.substring(0, name.length() - ".adoc".length()); + } + return name; + } + + private static boolean excludeDocumentDir(String name) { + for (String exclude : EXCLUDE_DOC_FILES) { + if (exclude.equals(name)) { + return true; + } + } + return false; + } + /** * Execute goal. * @@ -230,9 +249,11 @@ public class PrepareCatalogMojo extends AbstractMojo { Stream.concat(list(componentsDir.toPath()), Stream.of(coreDir.toPath(), modelDir.toPath(), baseDir.toPath(), languagesDir.toPath(), jaxpDir.toPath(), springDir.toPath())) - .filter(dir -> !"target".equals(dir.getFileName().toString())).map(this::getComponentPath) + .filter(dir -> !"target".equals(dir.getFileName().toString())) + .flatMap(p -> getComponentPath(p).stream()) .filter(dir -> Files.isDirectory(dir.resolve("src"))) - .map(p -> p.resolve("target/classes")).flatMap(PackageHelper::walk).forEach(p -> { + .map(p -> p.resolve("target/classes")) + .flatMap(PackageHelper::walk).forEach(p -> { String f = p.getFileName().toString(); if (f.endsWith(PackageHelper.JSON_SUFIX)) { allJsonFiles.add(p); @@ -388,11 +409,11 @@ public class PrepareCatalogMojo extends AbstractMojo { // check all the component options and grab the label(s) they // use model.getComponentOptions().stream().map(BaseOptionModel::getLabel).filter(l -> !Strings.isNullOrEmpty(l)).flatMap(l -> Stream.of(label.split(","))) - .forEach(usedOptionLabels::add); + .forEach(usedOptionLabels::add); // check all the endpoint options and grab the label(s) they use model.getEndpointOptions().stream().map(BaseOptionModel::getLabel).filter(l -> !Strings.isNullOrEmpty(l)).flatMap(l -> Stream.of(label.split(","))) - .forEach(usedOptionLabels::add); + .forEach(usedOptionLabels::add); long unused = model.getEndpointOptions().stream().map(BaseOptionModel::getLabel).filter(Strings::isNullOrEmpty).count(); if (unused >= UNUSED_LABELS_WARN) { @@ -462,7 +483,7 @@ public class PrepareCatalogMojo extends AbstractMojo { for (Path file : jsonFiles) { - DataFormatModel model = (DataFormatModel)allModels.get(file); + DataFormatModel model = (DataFormatModel) allModels.get(file); // Check labels String name = asComponentName(file); @@ -518,7 +539,7 @@ public class PrepareCatalogMojo extends AbstractMojo { for (Path file : jsonFiles) { - LanguageModel model = (LanguageModel)allModels.get(file); + LanguageModel model = (LanguageModel) allModels.get(file); // Check labels String name = asComponentName(file); @@ -572,6 +593,7 @@ public class PrepareCatalogMojo extends AbstractMojo { case "camel-fhir": case "camel-debezium-common": case "camel-vertx-kafka": + case "camel-infinispan": return false; default: return true; @@ -594,7 +616,7 @@ public class PrepareCatalogMojo extends AbstractMojo { for (Path file : jsonFiles) { - OtherModel model = (OtherModel)allModels.get(file); + OtherModel model = (OtherModel) allModels.get(file); String name = asComponentName(file); @@ -661,21 +683,27 @@ public class PrepareCatalogMojo extends AbstractMojo { Set<Path> duplicateAdocFiles = new TreeSet<>(); // find all camel maven modules - Stream.concat(list(componentsDir.toPath()).filter(dir -> !dir.getFileName().startsWith(".") && !"target".equals(dir.getFileName().toString())).map(this::getComponentPath), - Stream.of(coreDir.toPath(), baseDir.toPath(), languagesDir.toPath(), jaxpDir.toPath())) - .forEach(dir -> { - List<Path> l = PackageHelper.walk(dir.resolve("src/main/docs")).filter(f -> f.getFileName().toString().endsWith(".adoc")).collect(Collectors.toList()); - if (l.isEmpty()) { - String n = dir.getFileName().toString(); - boolean isDir = dir.toFile().isDirectory(); - boolean valid = isDir && !n.startsWith(".") && !n.endsWith("-base") && !n.endsWith("-common"); - if (valid) { - missingAdocFiles.add(dir); - } - } else { - adocFiles.addAll(l); + Stream.concat( + list(componentsDir.toPath()) + .filter(dir -> !dir.getFileName().startsWith(".") && !"target".equals(dir.getFileName().toString())) + .flatMap(p -> getComponentPath(p).stream()), + Stream.of(coreDir.toPath(), baseDir.toPath(), languagesDir.toPath(), jaxpDir.toPath())) + .forEach(dir -> { + List<Path> l = PackageHelper.walk(dir.resolve("src/main/docs")) + .filter(f -> f.getFileName().toString().endsWith(".adoc")) + .collect(Collectors.toList()); + + if (l.isEmpty()) { + String n = dir.getFileName().toString(); + boolean isDir = dir.toFile().isDirectory(); + boolean valid = isDir && !n.startsWith(".") && !n.endsWith("-base") && !n.endsWith("-common"); + if (valid) { + missingAdocFiles.add(dir); } - }); + } else { + adocFiles.addAll(l); + } + }); getLog().info("Found " + adocFiles.size() + " ascii document files"); @@ -688,7 +716,7 @@ public class PrepareCatalogMojo extends AbstractMojo { // Copy all descriptors Map<Path, Path> newJsons = map(adocFiles, p -> p, p -> documentsOutDir.resolve(p.getFileName())); list(documentsOutDir).filter(p -> !newJsons.containsValue(p) && !newJsons.containsValue(p.resolveSibling(p.getFileName().toString().replace(".html", ".adoc")))) - .forEach(this::delete); + .forEach(this::delete); newJsons.forEach(this::copy); Path all = documentsOutDir.resolve("../docs.properties"); @@ -1035,16 +1063,6 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().info("================================================================================"); } - private static String asComponentName(Path file) { - String name = file.getFileName().toString(); - if (name.endsWith(PackageHelper.JSON_SUFIX)) { - return name.substring(0, name.length() - PackageHelper.JSON_SUFIX.length()); - } else if (name.endsWith(".adoc")) { - return name.substring(0, name.length() - ".adoc".length()); - } - return name; - } - private void copyFile(Path file, Path toDir) throws IOException, MojoFailureException { if (Files.isRegularFile(file)) { // make sure to create out dir @@ -1059,15 +1077,6 @@ public class PrepareCatalogMojo extends AbstractMojo { } } - private static boolean excludeDocumentDir(String name) { - for (String exclude : EXCLUDE_DOC_FILES) { - if (exclude.equals(name)) { - return true; - } - } - return false; - } - private List<Path> concat(List<Path> l1, List<Path> l2) { return Stream.concat(l1.stream(), l2.stream()).collect(Collectors.toList()); } @@ -1142,26 +1151,28 @@ public class PrepareCatalogMojo extends AbstractMojo { return byName.values().stream().flatMap(l -> l.stream().skip(1)).collect(Collectors.toCollection(TreeSet::new)); } - private Path getComponentPath(Path dir) { + private List<Path> getComponentPath(Path dir) { switch (dir.getFileName().toString()) { case "camel-as2": - return dir.resolve("camel-as2-component"); + return Collections.singletonList(dir.resolve("camel-as2-component")); case "camel-salesforce": - return dir.resolve("camel-salesforce-component"); + return Collections.singletonList(dir.resolve("camel-salesforce-component")); case "camel-olingo2": - return dir.resolve("camel-olingo2-component"); + return Collections.singletonList(dir.resolve("camel-olingo2-component")); case "camel-olingo4": - return dir.resolve("camel-olingo4-component"); + return Collections.singletonList(dir.resolve("camel-olingo4-component")); case "camel-box": - return dir.resolve("camel-box-component"); + return Collections.singletonList(dir.resolve("camel-box-component")); case "camel-servicenow": - return dir.resolve("camel-servicenow-component"); + return Collections.singletonList(dir.resolve("camel-servicenow-component")); case "camel-fhir": - return dir.resolve("camel-fhir-component"); + return Collections.singletonList(dir.resolve("camel-fhir-component")); case "camel-vertx-kafka": - return dir.resolve("camel-vertx-kafka-component"); + return Collections.singletonList(dir.resolve("camel-vertx-kafka-component")); + case "camel-infinispan": + return Arrays.asList(dir.resolve("camel-infinispan"), dir.resolve("camel-infinispan-embedded")); default: - return dir; + return Collections.singletonList(dir); } }