Artemis Cloud Federation Example Configurations
Federated Artemis Cloud brokers require slightly different configuration in each node so that they point to each other. In this example, A hypothetical "Isla Nublar" (site A) and "Isla Sorna" (site B) employ federated Artemis Cloud brokers.
Apply the following broker.yaml custom resources (CRs) on each node with the following command:
kubectl apply -f broker-site.yaml
The following broker-a.yaml
is an example CR for the cluster at site A:
apiVersion: broker.amq.io/v1beta1
kind: ActiveMQArtemis
metadata:
name: site-a
spec:
acceptors:
- name: amqp
protocols: "AMQP"
port: 5672
- name: openwire
protocols: "OPENWIRE"
port: 61616
addressSettings:
applyRule: merge_all
addressSetting:
- autoCreateAddresses: true
autoCreateQueues: true
enableMetrics: true
- match: "#"
redistributionDelay: 5000
console:
name: site-a
useClientAuth: false
expose: true
exposeMode: ingress
ingressHost: isla-nublar.mshome.net
deploymentPlan:
size: 2
enableMetricsPlugin: true
requireLogin: false
persistenceEnabled: false
messageMigration: true
version: 2.33.0
connectors:
- name: site-b
host: isla-sorna.mshome.net
port: 30010
brokerProperties:
- "name=site-a"
- "globalMaxSize=1GiB"
- "federationConfigurations.site-a-to-site-b.upstreamConfigurations.site-b.connectionConfiguration.staticConnectors=site-b"
- "federationConfigurations.site-a-to-site-b.upstreamConfigurations.site-b.connectionConfiguration.retryInterval=500"
- "federationConfigurations.site-a-to-site-b.upstreamConfigurations.site-b.connectionConfiguration.retryIntervalMultiplier=2"
- "federationConfigurations.site-a-to-site-b.upstreamConfigurations.site-b.connectionConfiguration.maxRetryInterval=30000"
- "federationConfigurations.site-a-to-site-b.upstreamConfigurations.site-b.connectionConfiguration.circuitBreakerTimeout=30000"
- "federationConfigurations.site-a-to-site-b.upstreamConfigurations.site-b.policyRefs=queue-federation"
- "federationConfigurations.site-a-to-site-b.queuePolicies.queue-federation.includeFederated=false"
- "federationConfigurations.site-a-to-site-b.queuePolicies.queue-federation.maxHops=1"
- "federationConfigurations.site-a-to-site-b.queuePolicies.queue-federation.includes.all-app.queueMatch=#"
- 'addressConfigurations."demo.one".routingTypes=ANYCAST'
- 'addressConfigurations."demo.one".queueConfigs."demo.one".address=demo.one'
- 'addressConfigurations."demo.one".queueConfigs."demo.one".routingType=ANYCAST'
- 'addressConfigurations."demo.two".routingTypes=ANYCAST'
- 'addressConfigurations."demo.two".queueConfigs."demo.two".address=demo.two'
- 'addressConfigurations."demo.two".queueConfigs."demo.two".routingType=ANYCAST'
The following broker-b.yaml
is an example CR for the cluster at site B:
apiVersion: broker.amq.io/v1beta1
kind: ActiveMQArtemis
metadata:
name: site-b
spec:
acceptors:
- name: amqp
protocols: "AMQP"
port: 5672
- name: openwire
protocols: "OPENWIRE"
port: 61616
addressSettings:
applyRule: merge_all
addressSetting:
- autoCreateAddresses: true
autoCreateQueues: true
enableMetrics: true
- match: "#"
redistributionDelay: 5000
console:
name: site-b
useClientAuth: false
expose: true
exposeMode: ingress
ingressHost: isla-sorna.mshome.net
deploymentPlan:
size: 2
enableMetricsPlugin: true
requireLogin: false
persistenceEnabled: false
messageMigration: true
version: 2.33.0
connectors:
- name: site-a
host: isla-nublar.mshome.net
port: 30010
brokerProperties:
- "name=site-b"
- "globalMaxSize=1GiB"
- "federationConfigurations.site-b-to-site-a.upstreamConfigurations.site-a.connectionConfiguration.staticConnectors=site-a"
- "federationConfigurations.site-b-to-site-a.upstreamConfigurations.site-a.connectionConfiguration.retryInterval=500"
- "federationConfigurations.site-b-to-site-a.upstreamConfigurations.site-a.connectionConfiguration.retryIntervalMultiplier=2"
- "federationConfigurations.site-b-to-site-a.upstreamConfigurations.site-a.connectionConfiguration.maxRetryInterval=30000"
- "federationConfigurations.site-b-to-site-a.upstreamConfigurations.site-a.connectionConfiguration.circuitBreakerTimeout=30000"
- "federationConfigurations.site-b-to-site-a.upstreamConfigurations.site-a.policyRefs=queue-federation"
- "federationConfigurations.site-b-to-site-a.queuePolicies.queue-federation.includeFederated=false"
- "federationConfigurations.site-b-to-site-a.queuePolicies.queue-federation.maxHops=1"
- "federationConfigurations.site-b-to-site-a.queuePolicies.queue-federation.includes.all-app.queueMatch=#"
- 'addressConfigurations."demo.one".routingTypes=ANYCAST'
- 'addressConfigurations."demo.one".queueConfigs."demo.one".address=demo.one'
- 'addressConfigurations."demo.one".queueConfigs."demo.one".routingType=ANYCAST'
- 'addressConfigurations."demo.two".routingTypes=ANYCAST'
- 'addressConfigurations."demo.two".queueConfigs."demo.two".address=demo.two'
- 'addressConfigurations."demo.two".queueConfigs."demo.two".routingType=ANYCAST'
To expose the brokers to each other, add a NodePort
service to each site with the following command:
kubectl apply -f service-site.yaml
The following service-a.yaml
is an example NodePort
service for the cluster at site A:
apiVersion: v1
kind: Service
metadata:
labels:
ActiveMQArtemis: artemis-broker
application: artemis-broker-app
name: artemis-broker-exposed
spec:
ports:
- name: openwire
port: 61616
protocol: TCP
targetPort: 61616
nodePort: 30010
- name: ampq
port: 5672
protocol: TCP
targetPort: 5672
nodePort: 30011
selector:
ActiveMQArtemis: site-a
application: site-a-app
type: NodePort
The following service-b.yaml
is an example NodePort
service for the cluster at site B:
apiVersion: v1
kind: Service
metadata:
labels:
ActiveMQArtemis: artemis-broker
application: artemis-broker-app
name: artemis-broker-exposed
spec:
ports:
- name: openwire
port: 61616
protocol: TCP
targetPort: 61616
nodePort: 30010
- name: ampq
port: 5672
protocol: TCP
targetPort: 5672
nodePort: 30011
selector:
ActiveMQArtemis: site-b
application: site-b-app
type: NodePort
Once the Artemis Cloud broker is running, access the admin console at http://node-name.mshome.net
, in these examples,
http://isla-nublar.mshome.net
and http://isla-sorna.mshome.net
.