Este contenido no está disponible en el idioma seleccionado.

Chapter 3. Getting started


This chapter guides you through the steps to set up your environment and run a simple messaging program.

3.1. Prerequisites

3.2. Running Hello World

The Hello World example creates a connection to the broker, sends a message containing a greeting to the queue queue, and receives it back. On success, it prints the received message to the console.

Procedure

  1. Use Maven to build the examples by running the following command in the <source-dir>/qpid-jms-examples directory:

    $ mvn clean package dependency:copy-dependencies -DincludeScope=runtime -DskipTests
    Copy to Clipboard Toggle word wrap

    The addition of dependency:copy-dependencies results in the dependencies being copied into the target/dependency directory.

  2. Use the java command to run the example.

    On Linux or UNIX:

    $ java -cp "target/classes:target/dependency/*" org.apache.qpid.jms.example.HelloWorld
    Copy to Clipboard Toggle word wrap

    On Windows:

    > java -cp "target\classes;target\dependency\*" org.apache.qpid.jms.example.HelloWorld
    Copy to Clipboard Toggle word wrap

For example, running it on Linux results in the following output:

$ java -cp "target/classes/:target/dependency/*" org.apache.qpid.jms.example.HelloWorld
Hello world!
Copy to Clipboard Toggle word wrap

The source code for the example is in the <source-dir>/qpid-jms-examples/src/main/java directory. The JNDI and logging configuration is in the <source-dir>/qpid-jms-examples/src/main/resources directory.

Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat