此内容没有您所选择的语言版本。

Chapter 3. Getting started


This chapter guides you through a simple exercise to help you get started using AMQ .NET.

3.1. Preparing the broker

The example programs require a running broker with a queue named service_queue. Follow these steps to define the queue and start the broker:

Procedure

  1. Install the broker.
  2. Create a broker instance. Enable anonymous access.
  3. Start the broker instance and check the console for any critical errors logged during startup.

    $ <broker-instance-dir>/bin/artemis run
    ...
    14:43:20,158 INFO  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
    ...
    15:01:39,686 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:5672 for protocols [AMQP]
    ...
    15:01:39,691 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
  4. Use the artemis queue command to create a queue called service_queue.

    <broker-instance-dir>/bin/artemis queue create --name service_queue --auto-create-address --anycast

    You are prompted to answer a series of questions. For yes or no questions, type N. Otherwise, press Enter to accept the default value.

3.2. Building the examples

AMQ .NET provides example solution and project files to help users get started quickly.

Navigate to <install-dir> and open one of the solution files.

Solution FileVisual Studio Version

amqp.sln

Visual Studio 2013

amqp-vs2012.sln

Visual Studio 2012

Select Build Solution from the Build menu to compile the solution.

3.3. Running Hello World

Open a command prompt window and execute these commands to send and receive a message.

D:\>cd <install-dir>\bin\Debug
D:\>HelloWorld-Simple
Hello world!
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.