Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.此内容没有您所选择的语言版本。
Chapter 6. Integrate a Camel Application with the AMQ Broker
This tutorial shows how to deploy a quickstart using the A-MQ image.
6.1.1. Prerequisites 复制链接链接已复制到粘贴板!
- Ensure that CDK is installed and OpenShift is running correctly. See Section 3.1, “Prerequisites”.
- Ensure that Maven Repositories are configured for fuse, see Section 3.2.1, “Configure Maven Repositories”
6.1.2. Building and Deploying the Quickstart 复制链接链接已复制到粘贴板!
This example requires a JBoss A-MQ 6 image and deployment template. If you are using CDK 3.1.1+, JBoss A-MQ 6 images and templates should be already installed in the openshift
namespace by default.
To build and deploy the A-MQ quickstart, perform the following steps:
In your FIS environment, login as a developer, for example:
oc login -u developer -p developer
oc login -u developer -p developer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new project amq-quickstart
oc new-project amq-quickstart
oc new-project amq-quickstart
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Determine the version of the A-MQ 6 images and templates installed:
oc get template -n openshift
$ oc get template -n openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You should be able to find a template named
amqXX-basic
, whereXX
is the version of A-MQ installed in Openshift.Deploy the A-MQ 6 image in the
amq-quickstart
namespace (replaceXX
with the actual version of A-MQ found in previous step):oc process openshift//amqXX-basic -p APPLICATION_NAME=broker -p MQ_USERNAME=admin -p MQ_PASSWORD=admin -p MQ_QUEUES=test -n amq-quickstart | oc create -f -
$ oc process openshift//amqXX-basic -p APPLICATION_NAME=broker -p MQ_USERNAME=admin -p MQ_PASSWORD=admin -p MQ_QUEUES=test -n amq-quickstart | oc create -f -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis
oc
command could fail, if you use an older version ofoc
. This syntax works withoc
versions 3.5.x (based on Kubernetes 1.5.x).Add role which is needed for discovery of mesh endpoints (through Kubernetes REST API agent).
oc policy add-role-to-user view system:serviceaccount:amq-quickstart:default
$ oc policy add-role-to-user view system:serviceaccount:amq-quickstart:default
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the quickstart project using the Maven workflow:
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \ -DarchetypeCatalog=https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/2.2.195.redhat-000017/archetypes-catalog-2.2.195.redhat-000017-archetype-catalog.xml \ -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \ -DarchetypeArtifactId=spring-boot-camel-amq-archetype \ -DarchetypeVersion=2.2.195.redhat-000017
$ mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \ -DarchetypeCatalog=https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/2.2.195.redhat-000017/archetypes-catalog-2.2.195.redhat-000017-archetype-catalog.xml \ -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \ -DarchetypeArtifactId=spring-boot-camel-amq-archetype \ -DarchetypeVersion=2.2.195.redhat-000017
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The archetype plug-in switches to interactive mode to prompt you for the remaining fields:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When prompted, enter
org.example.fis
for thegroupId
value andfis-spring-boot-camel-amq
for theartifactId
value. Accept the defaults for the remaining fields.Navigate to the quickstart directory
fis-spring-boot-camel-amq
:cd fis-spring-boot-camel-amq
$ cd fis-spring-boot-camel-amq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Customize the client credentials for logging on to the broker, by setting the
ACTIVEMQ_BROKER_USERNAME
andACTIVEMQ_BROKER_PASSWORD
environment variables. In thefis-spring-boot-camel-amq
project, edit thesrc/main/fabric8/deployment.yml
file, as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
mvn
command to deploy the quickstart to OpenShift server.mvn fabric8:deploy
mvn fabric8:deploy
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To verify that the quickstart is running successfully, navigate to the OpenShift console, select the project amq-quickstart, click Applications, select Pods, click fis-spring-boot-camel-am-1-xxxxx, and click Logs.
The output shows the messages are sent successfully.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To view the routes on the web interface, click Open Java Console and check the messages in the A-MQ queue.