Infinispan Source
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
Receives an event each time an entry of a cache on a remote Infinispan server, or Red Hat Data Grid, is created, changed, removed or expires, one message per event.
Use it to react to changes in a shared cache, for example to update a search index or notify another service when a value changes. To write to a cache, use infinispan-sink.
Output: the message has no body: the event is in headers. infinispan-event-type is the kind of event, such as CLIENT_CACHE_ENTRY_CREATED, infinispan-key the key of the entry, infinispan-cache-name the name of the cache and infinispan-entry-version the version of the entry. The same values are in ce-infinispaneventtype, ce-infinispankey, ce-infinispancachename and ce-infinispanentryversion. To read the value, look up the key in the cache.
Good to know: only the changes made while the integration runs are received. The cache must already exist on the server. Recent Infinispan servers do not accept the default saslMechanism of DIGEST-MD5: set it to SCRAM-SHA-512. The connection has TLS only when sslTruststoreLocation is set, together with sslSniHostName.
Configuration Options
The following table summarizes the configuration options available for the infinispan-source Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Cache Name | Required The name of the cache to watch. It must exist on the server. | string | orders | ||
Hosts | Required The address of the Infinispan server, as | string | infinispan.example.com:11222 | ||
Password | Required The password of the Infinispan user in | string | |||
Username | Required The Infinispan user to log in as. | string | |||
Event Types | The kinds of events to receive, separated by commas without spaces. Enum values: * CLIENT_CACHE_ENTRY_CREATED * CLIENT_CACHE_ENTRY_MODIFIED * CLIENT_CACHE_ENTRY_REMOVED * CLIENT_CACHE_ENTRY_EXPIRED * CLIENT_CACHE_FAILOVER | string | CLIENT_CACHE_ENTRY_CREATED,CLIENT_CACHE_ENTRY_MODIFIED,CLIENT_CACHE_ENTRY_REMOVED,CLIENT_CACHE_ENTRY_EXPIRED,CLIENT_CACHE_FAILOVER | CLIENT_CACHE_ENTRY_CREATED,CLIENT_CACHE_ENTRY_MODIFIED | |
SASL Mechanism | How the user and password are checked by the server. Recent Infinispan servers accept | string | DIGEST-MD5 | SCRAM-SHA-512 | |
Secure | If true, it logs in with | boolean | true | ||
Security Realm | The security realm of the server that holds the user. Keep the default unless your Infinispan administrator set up another realm. | string | default | ||
Security Server Name | The name of the server, used when logging in. Keep the default unless your Infinispan administrator changed it. | string | infinispan | ||
TLS Server Name | The host name of the server as its certificate names it, such as | string | infinispan.example.com | ||
Trust Store Location | The path of a file with the certificate of the server, or of the authority that signed it, to connect with TLS. It is a trust store in PKCS12 or JKS format, which needs | string | /etc/infinispan/truststore.p12 | ||
Trust Store Password | The password of the trust store file in | string |
Dependencies
At runtime, the infinispan-source Kamelet relies upon the presence of the following dependencies:
-
camel:kamelet
-
camel:infinispan
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:infinispan-source"
parameters:
.
.
.
steps:
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml Infinispan Source Kamelet Description
Authentication methods
This Kamelet uses username and password authentication to connect to Infinispan cache. You need to provide:
-
Username and password for Infinispan authentication
-
Host information for the Infinispan instance
-
Optionally, security settings (login enabled by default with
secure; TLS whensslTruststoreLocationis set)
Output format
The Kamelet receives an event for each change of an entry in the cache. The message has no body: the event type, the key, the cache name and the version of the entry are in the infinispan-event-type, infinispan-key, infinispan-cache-name and infinispan-entry-version headers.
Configuration
The Kamelet requires the following parameters:
-
cacheName: The name of the Infinispan cache to use -
hosts: Specifies the host of the cache on Infinispan instance -
username: Username to connect to Infinispan -
password: Password to connect to Infinispan
Optional parameters: - secure: If the Infinispan instance is secured or not (default: true) - sslTruststoreLocation: A trust store (PKCS12 or JKS, with sslTruststorePassword) or a PEM file with the certificate of the server, or of the authority that signed it. Setting it turns on TLS. - sslSniHostName: The host name the certificate of the server is for. Required with sslTruststoreLocation.
Example with TLS
The Infinispan client checks the certificate of the server against the file in sslTruststoreLocation only: it does not use the certificates that Java trusts by default.
- route:
from:
uri: "kamelet:infinispan-source"
parameters:
cacheName: "orders"
hosts: "infinispan.example.com:11222"
username: "camel"
password: "secret"
saslMechanism: "SCRAM-SHA-512"
sslTruststoreLocation: "/etc/infinispan/truststore.p12"
sslTruststorePassword: "changeit"
sslSniHostName: "infinispan.example.com"
steps:
- to: "log:orders" Usage example
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: infinispan-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: infinispan-source
properties:
cacheName: "my-cache"
hosts: "infinispan-server:11222"
username: "{{username}}"
password: "{{password}}"
secure: true
sink:
ref:
kind: Service
apiVersion: v1
name: my-service