Chapter 8. Integrating a Camel application with the A-MQ broker
This tutorial shows how to deploy a quickstart using the A-MQ image.
8.1. Building and deploying a Spring Boot Camel A-MQ quickstart Copy linkLink copied to clipboard!
This quickstart demonstrates how to connect a Spring Boot application to AMQ Online and use JMS messaging between two Camel routes using Fuse on OpenShift.
Prerequisites
- Ensure that AMQ Online is deployed and running. To install AMQ Online on OpenShift see Installing and configuring AMQ Online on OpenShift.
- Ensure that OpenShift is running correctly and the Fuse image streams are already installed in OpenShift. See Getting Started for Administrators.
- Ensure that Maven Repositories are configured for fuse, see Configuring Maven Repositories.
Procedure
Log in to the OpenShift server as a developer.
oc login -u developer -p developer
oc login -u developer -p developer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Log in to the
openshift
project.oc project openshift
oc project openshift
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.0.fuse-760024-redhat-00001/archetypes-catalog-2.2.0.fuse-760024-redhat-00001-archetype-catalog.xml \ -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \ -DarchetypeArtifactId=spring-boot-camel-amq-archetype \ -DarchetypeVersion=2.2.0.fuse-760024-redhat-00001
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.0.fuse-760024-redhat-00001/archetypes-catalog-2.2.0.fuse-760024-redhat-00001-archetype-catalog.xml \ -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \ -DarchetypeArtifactId=spring-boot-camel-amq-archetype \ -DarchetypeVersion=2.2.0.fuse-760024-redhat-00001
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 andfuse76-spring-boot-camel-amq
for theartifactId
value. Accept the defaults for the remaining fields.Navigate to the quickstart directory
fuse76-spring-boot-camel-amq
.cd fuse76-spring-boot-camel-amq
cd fuse76-spring-boot-camel-amq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following commands to apply configuration files to AMQ Online. These configuration files create the AMQ Online user and the queue, both with the admin privileges.
oc login -u system:admin oc apply -f src/main/resources/k8s
oc login -u system:admin oc apply -f src/main/resources/k8s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
mvn
command to deploy the quickstart to the OpenShift server.mvn fabric8:deploy -Popenshift
mvn fabric8:deploy -Popenshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To verify that the quickstart is running successfully:
- Navigate to the OpenShift web console in your browser (https://OPENSHIFT_IP_ADDR, replace OPENSHIFT_IP_ADDR with the IP address of the cluster) and log in to the console with your credentials (for example, with username developer and password, developer).
-
In the left hand side panel, expand
Home
and then clickStatus
to view the Project Status page foropenshift
project. -
Click
fuse76-spring-boot-camel-amq
to view the Overview information page for the quickstart. -
In the left hand side panel, expand
Workloads
. -
Click
Pods
and then clickfuse76-spring-boot-camel-amq-xxxxx
. The pod details for the quickstart are displayed. Click
Logs
to view the logs for the application.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 AMQ queue.