Este conteúdo não está disponível no idioma selecionado.

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 <install-dir>/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 <install-dir>/examples/src/main/java directory. The JNDI and logging configuration is in the <install-dir>/examples/src/main/resources directory.

Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat