// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-infinispan"]
= Infinispan
:page-aliases: extensions/infinispan.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-infinispan
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Read and write from/to Infinispan distributed key/value store and data grid.
:cq-deprecated: false
:cq-jvm-since: 0.0.1
:cq-native-since: 0.0.1

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##0.0.1## [.badge-key]##Native since##[.badge-supported]##0.0.1##
endif::[]

Read and write from/to Infinispan distributed key/value store and data grid.

[id="extensions-infinispan-whats-inside"]
== What's inside

* xref:{cq-camel-components}::infinispan-component.adoc[Infinispan component], URI syntax: `infinispan:cacheName`

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

[id="extensions-infinispan-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-infinispan[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-infinispan</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-infinispan-usage"]
== Usage
[id="extensions-infinispan-usage-infinispan-client-configuration"]
=== Infinispan client configuration

You can configure Camel Infinispan in one of two ways.

1. Using the relevant Camel Infinispan xref:{cq-camel-components}::infinispan-component.adoc#_component_options[component & endpoint options]

2. Using the https://quarkus.io/guides/infinispan-client#configuration-reference[Quarkus Infinispan extension configuration properties].

More details about these two configuration methods is described below.

[id="extensions-infinispan-usage-camel-infinispan-component-and-endpoint-configuration"]
=== Camel Infinispan component and endpoint configuration

When using 'pure' Camel Infinispan component and endpoint configuration (I.e. where's there's no `quarkus.infinispan-client` configuration set), you *must* disable generation of the default Quarkus Infinispan `RemoteCacheManager` bean by adding the following configuration to `application.properties`.

[source,properties]
----
quarkus.infinispan-client.devservices.create-default-client=false
----

If you wish to take advantage of https://quarkus.io/guides/infinispan-dev-services[Quarkus Dev Services for Infinispan], the Camel Infinispan component can be configured as follows in `application.properties`.

[source,properties]
----
# dev / test mode Quarkus Infinispan Dev services configuration
quarkus.infinispan-client.devservices.port=31222
%dev,test.camel.component.infinispan.username=admin
%dev,test.camel.component.infinispan.password=password
%dev,test.camel.component.infinispan.secure=true
%dev,test.camel.component.infinispan.hosts=localhost:31222

# Example prod mode configuration
%prod.camel.component.infinispan.username=prod-user
%prod.camel.component.infinispan.password=prod-password
%prod.camel.component.infinispan.secure=true
%prod.camel.component.infinispan.hosts=infinispan.prod:11222
----

[id="extensions-infinispan-usage-quarkus-infinispan-configuration"]
=== Quarkus Infinispan configuration

When using the https://quarkus.io/guides/infinispan-client#configuration-reference[Quarkus Infinispan extension configuration properties], the Quarkus Infinispan extensions creates and manages a `RemoteCacheManager` bean.

The bean will get automatically autowired into the Camel Infinispan component on application startup.

Note that to materialize the `RemoteCacheManager` beans, you *must* add injection points for them. For example:

[source,java]
----
public class Routes extends RouteBuilder {
    // Injects the default unnamed RemoteCacheManager
    @Inject
    RemoteCacheManager cacheManager;

    // If configured, injects an optional named RemoteCacheManager
    @Inject
    @InfinispanClientName("myNamedClient")
    RemoteCacheManager namedCacheManager;

    @Override
    public void configure() {
        // Route configuration here...
    }
}
----


[id="extensions-infinispan-additional-camel-quarkus-configuration"]
== Additional Camel Quarkus configuration

[id="extensions-infinispan-configuration-camel-infinispan-infinispanremoteaggregationrepository-in-native-mode"]
=== Camel Infinispan `InfinispanRemoteAggregationRepository` in native mode

If you chose to use the `InfinispanRemoteAggregationRepository` in native mode, then you must xref:extensions/core.adoc#quarkus-camel-native-reflection-serialization-enabled[enable native serialization support].

