Questo contenuto non è disponibile nella lingua selezionata.

Chapter 9. Integrating a Camel application with the A-MQ broker


This tutorial shows how to deploy a quickstart using the A-MQ image.

9.1. Building and deploying a Spring Boot Camel A-MQ quickstart

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

Procedure

  1. Log in to the OpenShift server as a developer.

    oc login -u developer -p developer
    Copy to Clipboard Toggle word wrap
  2. Log in to the openshift project.

    oc project openshift
    Copy to Clipboard Toggle word wrap
  3. 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-sb2-7_11_1-00018-redhat-00002/archetypes-catalog-2.2.0.fuse-sb2-7_11_1-00018-redhat-00002-archetype-catalog.xml \
    -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \
    -DarchetypeArtifactId=spring-boot-camel-amq-archetype \
    -DarchetypeVersion=2.2.0.fuse-sb2-7_11_1-00018-redhat-00002
    Copy to Clipboard Toggle word wrap
  4. The archetype plug-in switches to interactive mode to prompt you for the remaining fields.

    Define value for property 'groupId': : org.example.fis
    Define value for property 'artifactId': : fuse77-spring-boot-camel-amq
    Define value for property 'version':  1.0-SNAPSHOT: :
    Define value for property 'package':  org.example.fis: :
    Confirm properties configuration:
    groupId: org.example.fis
    artifactId: fuse77-spring-boot-camel-amq
    version: 1.0-SNAPSHOT
    package: org.example.fis
    Y: :Y
    Copy to Clipboard Toggle word wrap

    When prompted, enter org.example.fis for the groupId value and fuse77-spring-boot-camel-amq for the artifactId value. Accept the defaults for the remaining fields.

  5. Navigate to the quickstart directory fuse77-spring-boot-camel-amq.

    cd fuse77-spring-boot-camel-amq
    Copy to Clipboard Toggle word wrap
  6. 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
    Copy to Clipboard Toggle word wrap
  7. Run the mvn command to deploy the quickstart to the OpenShift server.

    mvn fabric8:deploy -Popenshift
    Copy to Clipboard Toggle word wrap
  8. To verify that the quickstart is running successfully:

    1. 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).
    2. In the left hand side panel, expand Home and then click Status to view the Project Status page for openshift project.
    3. Click fuse77-spring-boot-camel-amq to view the Overview information page for the quickstart.
    4. In the left hand side panel, expand Workloads.
    5. Click Pods and then click fuse77-spring-boot-camel-amq-xxxxx. The pod details for the quickstart are displayed.
    6. Click Logs to view the logs for the application.

      The output shows the messages are sent successfully.

      10:17:59.825 [Camel (camel) thread #10 - timer://order] INFO  generate-order-route - Generating order order1379.xml
      10:17:59.829 [Camel (camel) thread #8 - JmsConsumer[incomingOrders]] INFO  jms-cbr-route - Sending order order1379.xml to the UK
      10:17:59.829 [Camel (camel) thread #8 - JmsConsumer[incomingOrders]] INFO  jms-cbr-route - Done processing order1379.xml
      10:18:02.825 [Camel (camel) thread #10 - timer://order] INFO  generate-order-route - Generating order order1380.xml
      10:18:02.829 [Camel (camel) thread #7 - JmsConsumer[incomingOrders]] INFO  jms-cbr-route - Sending order order1380.xml to another country
      10:18:02.829 [Camel (camel) thread #7 - JmsConsumer[incomingOrders]] INFO jms-cbr-route - Done processing order1380.xml
      Copy to Clipboard Toggle word wrap
  9. To view the routes on the web interface, click Open Java Console and check the messages in the AMQ queue.
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat