---
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ConfigMap
metadata:
labels:
funktion.fabric8.io/kind: Connector
provider: fabric8
project: connector-jgroups
version: 1.1.41
group: io.fabric8.funktion.connector
name: jgroups
data:
deployment.yml: |
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
funktion.fabric8.io/kind: Subscription
connector: jgroups
spec:
replicas: 1
template:
metadata:
labels:
funktion.fabric8.io/kind: Subscription
connector: jgroups
spec:
containers:
- image: funktion/connector-jgroups:1.1.41
name: connector
schema.yml: |
---
component:
kind: component
scheme: jgroups
syntax: jgroups:clusterName
title: JGroups
description: The jgroups component provides exchange of messages between Camel and JGroups clusters.
label: clustering,messaging
deprecated: false
async: false
javaType: org.apache.camel.component.jgroups.JGroupsComponent
groupId: org.apache.camel
artifactId: camel-jgroups
version: 2.18.1
componentProperties:
channel:
kind: property
type: object
javaType: org.jgroups.Channel
deprecated: false
secret: false
description: Channel to use
order: 0
channelProperties:
kind: property
type: string
javaType: java.lang.String
deprecated: false
secret: false
description: Specifies configuration properties of the JChannel used by the endpoint.
order: 1
enableViewMessages:
kind: property
type: boolean
javaType: boolean
deprecated: false
secret: false
description: If set to true the consumer endpoint will receive org.jgroups.View messages as well (not only org.jgroups.Message instances). By default only regular messages are consumed by the endpoint.
order: 2
properties:
clusterName:
kind: path
group: common
required: true
type: string
javaType: java.lang.String
deprecated: false
secret: false
description: The name of the JGroups cluster the component should connect to.
order: 0
channelProperties:
kind: parameter
group: common
type: string
javaType: java.lang.String
deprecated: false
secret: false
description: Specifies configuration properties of the JChannel used by the endpoint.
order: 1
bridgeErrorHandler:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
optionalPrefix: consumer.
deprecated: false
secret: false
defaultValue: false
description: 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/ERROR level and ignored.
order: 2
enableViewMessages:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: If set to true the consumer endpoint will receive org.jgroups.View messages as well (not only org.jgroups.Message instances). By default only regular messages are consumed by the endpoint.
order: 3
exceptionHandler:
kind: parameter
group: consumer (advanced)
label: consumer,advanced
type: object
javaType: org.apache.camel.spi.ExceptionHandler
optionalPrefix: consumer.
deprecated: false
secret: false
description: To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
order: 4
exchangePattern:
kind: parameter
group: consumer (advanced)
label: consumer,advanced
type: string
javaType: org.apache.camel.ExchangePattern
enum:
- InOnly
- RobustInOnly
- InOut
- InOptionalOut
- OutOnly
- RobustOutOnly
- OutIn
- OutOptionalIn
deprecated: false
secret: false
description: Sets the exchange pattern when the consumer creates an exchange.
order: 5
synchronous:
kind: parameter
group: advanced
label: advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
order: 6
documentation.adoc: "[[JGroups-JGroupsComponent]]\nJGroups Component\n~~~~~~~~~~~~~~~~~\n\
\n*Available since Camel 2.10.0*\n\nhttp://www.jgroups.org[JGroups] is a toolkit\
\ for reliable multicast\ncommunication. The *jgroups:* component provides exchange\
\ of messages\nbetween Camel infrastructure and http://jgroups.org[JGroups]\
\ clusters.\n\nMaven users will need to add the following dependency to their\
\ `pom.xml`\nfor this component.\n\n[source,xml]\n------------------------------------------------------------\n\
\n org.apache-extras.camel-extra\n camel-jgroups\n\
\ \n x.y.z\n\
\n------------------------------------------------------------\n\
\nStarting from the Camel *2.13.0*, JGroups component has been moved from\n\
Camel Extra under the umbrella of the Apache Camel. If you are using\nCamel\
\ *2.13.0* or higher, please use the following POM entry instead.\n\n[source,xml]\n\
------------------------------------------------------------\n\n\
\ org.apache.camel\n camel-jgroups\n\
\ \n ??x.y.z\n\
\n------------------------------------------------------------\n\
\n[[JGroups-URIformat]]\nURI format\n^^^^^^^^^^\n\n[source,java]\n-----------------------------\n\
jgroups:clusterName[?options]\n-----------------------------\n\nWhere *clusterName*\
\ represents the name of the JGroups cluster the\ncomponent should connect to.\n\
\n[[JGroups-Options]]\nOptions\n^^^^^^^\n\n\n\n\n// component options: START\n\
The JGroups component supports 3 options which are listed below.\n\n\n\n{% raw\
\ %}\n[width=\"100%\",cols=\"2,1m,7\",options=\"header\"]\n|=======================================================================\n\
| Name | Java Type | Description\n| channel | Channel | Channel to use\n| channelProperties\
\ | String | Specifies configuration properties of the JChannel used by the\
\ endpoint.\n| enableViewMessages | boolean | If set to true the consumer endpoint\
\ will receive org.jgroups.View messages as well (not only org.jgroups.Message\
\ instances). By default only regular messages are consumed by the endpoint.\n\
|=======================================================================\n{%\
\ endraw %}\n// component options: END\n\n\n\n\n\n\n// endpoint options: START\n\
The JGroups component supports 7 endpoint options which are listed below:\n\n\
{% raw %}\n[width=\"100%\",cols=\"2,1,1m,1m,5\",options=\"header\"]\n|=======================================================================\n\
| Name | Group | Default | Java Type | Description\n| clusterName | common |\
\ | String | *Required* The name of the JGroups cluster the component should\
\ connect to.\n| channelProperties | common | | String | Specifies configuration\
\ properties of the JChannel used by the endpoint.\n| bridgeErrorHandler | consumer\
\ | false | boolean | 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/ERROR level and ignored.\n| enableViewMessages | consumer\
\ | false | boolean | If set to true the consumer endpoint will receive org.jgroups.View\
\ messages as well (not only org.jgroups.Message instances). By default only\
\ regular messages are consumed by the endpoint.\n| exceptionHandler | consumer\
\ (advanced) | | ExceptionHandler | To let the consumer use a custom ExceptionHandler.\
\ Notice if the option bridgeErrorHandler is enabled then this options is not\
\ in use. By default the consumer will deal with exceptions that will be logged\
\ at WARN/ERROR level and ignored.\n| exchangePattern | consumer (advanced)\
\ | | ExchangePattern | Sets the exchange pattern when the consumer creates\
\ an exchange.\n| synchronous | advanced | false | boolean | Sets whether synchronous\
\ processing should be strictly used or Camel is allowed to use asynchronous\
\ processing (if supported).\n|=======================================================================\n\
{% endraw %}\n// endpoint options: END\n\n\n\n[[JGroups-Headers]]\nHeaders\n\
^^^^^^^\n\n[width=\"100%\",cols=\"10%,10%,10%,70%\",options=\"header\",]\n|=======================================================================\n\
|Header |Constant |Since version |Description\n\n|`JGROUPS_ORIGINAL_MESSAGE`\
\ |`JGroupsEndpoint.HEADER_JGROUPS_ORIGINAL_MESSAGE` |*2.13.0* |The original\
\ `org.jgroups.Message` instance from which the body of the\nconsumed message\
\ has been extracted.\n\n|`JGROUPS_SRC` |`JGroupsEndpoint.`HEADER_JGROUPS_SRC\
\ |*2.10.0* | *Consumer* : The `org.jgroups.Address` instance extracted by\n\
`org.jgroups.Message`.getSrc() method of the consumed message. \n*Producer*:\
\ The custom source `org.jgroups.Address` of the message to be sent.\n\n|`JGROUPS_DEST`\
\ |`JGroupsEndpoint.`HEADER_JGROUPS_DEST |*2.10.0* |*Consumer*: The `org.jgroups.Address`\
\ instance extracted by\n`org.jgroups.Message`.getDest() method of the consumed\
\ message.\n*Producer*: The custom destination `org.jgroups.Address` of the\
\ message to be sent.\n\n|`JGROUPS_CHANNEL_ADDRESS` |`JGroupsEndpoint.`HEADER_JGROUPS_CHANNEL_ADDRESS\
\ |*2.13.0* |Address (`org.jgroups.Address`) of the channel associated with\
\ the\nendpoint.\n|=======================================================================\n\
??\n[[JGroups-Usage]]\nUsage\n^^^^^\n\nUsing `jgroups` component on the consumer\
\ side of the route will capture\nmessages received by the `JChannel` associated\
\ with the endpoint and\nforward them to the Camel route. JGroups consumer processes\
\ incoming\nmessages\nhttp://camel.apache.org/asynchronous-routing-engine.html[asynchronously].\n\
\n[source,java]\n----------------------------------------------\n// Capture\
\ messages from cluster named\n// 'clusterName' and send them to Camel route.\n\
from(\"jgroups:clusterName\").to(\"seda:queue\");\n----------------------------------------------\n\
\nUsing `jgroups` component on the producer side of the route will forward\n\
body of the Camel exchanges to the `JChannel` instance managed by the\nendpoint.\n\
\n[source,java]\n--------------------------------------------------\n// Send\
\ message to the cluster named 'clusterName'\nfrom(\"direct:start\").to(\"jgroups:clusterName\"\
);\n--------------------------------------------------\n\n[[JGroups-Predefinedfilters]]\n\
Predefined filters\n^^^^^^^^^^^^^^^^^^\n\nStarting from version *2.13.0* of\
\ Camel, JGroups component comes with\npredefined filters factory class named\
\ `JGroupsFilters.`\n\nIf you would like to consume only view changes notifications\
\ sent to\ncoordinator of the cluster (and ignore these sent to the \"slave\"\
\ nodes),\nuse the `JGroupsFilters.dropNonCoordinatorViews()` filter. This filter\n\
is particularly useful when you want a single Camel node to become the\nmaster\
\ in the cluster, because messages passing this filter notifies you\nwhen given\
\ node has become a coordinator of the cluster. The snippet\nbelow demonstrates\
\ how to collect only messages received by the master\nnode.\n\n[source,java]\n\
----------------------------------------------------------------------------------------\n\
import static org.apache.camel.component.jgroups.JGroupsFilters.dropNonCoordinatorViews;\n\
...\nfrom(\"jgroups:clusterName?enableViewMessages=true\").\n filter(dropNonCoordinatorViews()).\n\
\ to(\"seda:masterNodeEventsQueue\");\n----------------------------------------------------------------------------------------\n\
\n[[JGroups-Predefinedexpressions]]\nPredefined expressions\n^^^^^^^^^^^^^^^^^^^^^^\n\
\nStarting from version *2.13.0* of Camel, JGroups component comes with\npredefined\
\ expressions factory class named `JGroupsExpressions.`\n\nIf you would like\
\ to create link:delayer.html[delayer] that would affect\nthe route only if\
\ the Camel context has not been started yet, use the\n`JGroupsExpressions.delayIfContextNotStarted(long\
\ delay)` factory\nmethod. The expression created by this factory method will\
\ return given\ndelay value only if the Camel context is in the state different\
\ than\n`started`. This expression is particularly useful if you would like\
\ to\nuse JGroups component for keeping singleton (master) route within the\n\
cluster. link:controlbus-component.html[Control Bus] `start` command\nwon't\
\ initialize the singleton route if the Camel Context hasn't been\nyet started.\
\ So you need to delay a startup of the master route, to be\nsure that it has\
\ been initialized after the Camel Context startup.\nBecause such scenario can\
\ happen only during the initialization of the\ncluster, we don't want to delay\
\ startup of the slave node becoming the\nnew master - that's why we need a\
\ conditional delay expression.\n\nThe snippet below demonstrates how to use\
\ conditional delaying with the\nJGroups component to delay the initial startup\
\ of master node in the\ncluster.\n\n[source,java]\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------\n\
import static java.util.concurrent.TimeUnit.SECONDS;\nimport static org.apache.camel.component.jgroups.JGroupsExpressions.delayIfContextNotStarted;\n\
import static org.apache.camel.component.jgroups.JGroupsFilters.dropNonCoordinatorViews;\n\
...\nfrom(\"jgroups:clusterName?enableViewMessages=true\").\n filter(dropNonCoordinatorViews()).\n\
\ threads().delay(delayIfContextNotStarted(SECONDS.toMillis(5))). // run in\
\ separated and delayed thread. Delay only if the context hasn't been started\
\ already. \n ??to(\"controlbus:route?routeId=masterRoute&action=start&async=true\"\
);\n\nfrom(\"timer://master?repeatCount=1\").routeId(\"masterRoute\").autoStartup(false).to(masterMockUri);?\
?\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------\n\
\n[[JGroups-Examples]]\nExamples\n^^^^^^^^\n\n[[JGroups-SendingreceivingmessagestofromtheJGroupscluster]]\n\
Sending (receiving) messages to (from) the JGroups cluster\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\
\nIn order to send message to the JGroups cluster use producer endpoint,\njust\
\ as demonstrated on the snippet below.\n\n[source,java]\n------------------------------------------------\n\
from(\"direct:start\").to(\"jgroups:myCluster\");\n...\nproducerTemplate.sendBody(\"\
direct:start\", \"msg\")\n------------------------------------------------\n\
\nTo receive the message from the snippet above (on the same or the other\n\
physical machine) listen on the messages coming from the given cluster,\njust\
\ as demonstrated on the code fragment below.\n\n[source,java]\n------------------------------------------------------------\n\
mockEndpoint.setExpectedMessageCount(1);\nmockEndpoint.message(0).body().isEqualTo(\"\
msg\");\n...\nfrom(\"jgroups:myCluster\").to(\"mock:messagesFromTheCluster\"\
);\n...\nmockEndpoint.assertIsSatisfied();\n------------------------------------------------------------\n\
\n[[JGroups-Receiveclusterviewchangenotifications]]\nReceive cluster view change\
\ notifications\n+++++++++++++++++++++++++++++++++++++++++\n\nThe snippet below\
\ demonstrates how to create the consumer endpoint\nlistening to the??notifications\
\ regarding cluster membership changes. By\ndefault only regular messages are\
\ consumed by the endpoint.\n\n[source,java]\n---------------------------------------------------------------------\n\
mockEndpoint.setExpectedMessageCount(1);\nmockEndpoint.message(0).body().isInstanceOf(org.jgroups.View.class);\n\
...\nfrom(\"jgroups:clusterName?enableViewMessages=true\").to(mockEndpoint);\n\
...\nmockEndpoint.assertIsSatisfied();\n---------------------------------------------------------------------\n\
\n[[JGroups-Keepingsingletonroutewithinthecluster]]\nKeeping singleton route\
\ within the cluster\n++++++++++++++++++++++++++++++++++++++++++\n\nThe snippet\
\ below demonstrates how to keep the singleton consumer route\nin the cluster\
\ of Camel Contexts. As soon as the master node dies, one\nof the slaves will\
\ be elected as a new master and started. In this\nparticular example we want\
\ to keep singleton link:jetty.html[jetty]\ninstance listening for the requests\
\ on\naddress` http://localhost:8080/orders`.\n\n[source,java]\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------\n\
import static java.util.concurrent.TimeUnit.SECONDS;\nimport static org.apache.camel.component.jgroups.JGroupsExpressions.delayIfContextNotStarted;\n\
import static org.apache.camel.component.jgroups.JGroupsFilters.dropNonCoordinatorViews;\n\
...\nfrom(\"jgroups:clusterName?enableViewMessages=true\").\n filter(dropNonCoordinatorViews()).\n\
\ threads().delay(delayIfContextNotStarted(SECONDS.toMillis(5))). // run in\
\ separated and delayed thread. Delay only if the context hasn't been started\
\ already. \n ??to(\"controlbus:route?routeId=masterRoute&action=start&async=true\"\
);\n\nfrom(\"jetty:http://localhost:8080/orders\").routeId(\"masterRoute\").autoStartup(false).to(\"\
jms:orders\");??\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------\n"