Chapter 3. Getting started
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 You must complete the installation procedure for your environment. You must have an AMQP 1.0 message broker listening for connections on interface localhost and port 5672 . It must have anonymous access enabled. For more information, see Starting the broker . You must have a queue named hello-world-example . For more information, see Creating a queue . Alternatively, you can specify above information using following environment variables: HOST , PORT , ADDRESS The examples are available from the source or upstream Download the amq-qpid-proton-dotnet-1.0.0-M9-src .zip file. When you extract the contents of the .zip file, a directory named amq-dotnet-1.0.0-M9-src is created. This is the top-level directory of the installation and is referred to as <src-install-dir> throughout this document. 3.2. Running HelloWorld on Red Hat Enterprise Linux The Hello World example creates a connection to the broker, sends a message containing a greeting to the hello-world-example queue, and receives it back. On success, it prints the received message to the console. Change to the <source-dir> /examples/Example.HelloWorld/ and use dotnet run to build and execute the program. USD cd <source-dir> /examples/Example.HelloWorld/ USD dotnet run Received message with body: Hello World 3.3. Running Hello World on Microsoft Windows The Hello World example creates a connection to the broker, sends a message containing a greeting to the hello-world-example queue, and receives it back. On success, it prints the received message to the console. Procedure Navigate to <source-dir> and open the Proton.sln solution file in Visual Studio. Select Build Solution from the Build menu to compile the solution. Open a command prompt window and execute the following commands to send and receive a message: > cd <source-dir> \bin\Debug > Example.HelloWorld Received message with body: Hello World
cd <source-dir> /examples/Example.HelloWorld/ dotnet run Received message with body: Hello World > cd <source-dir> \bin\Debug > Example.HelloWorld Received message with body: Hello World