B.2. helloworld 简单
helloworld-simple 是一个简单的示例,它为同一地址创建 Sender 和 Receiver,发送消息到该地址,从地址读取消息,然后打印结果。
helloworld-simple 命令行选项
Command line: HelloWorld-simple [brokerUrl [brokerEndpointAddress]] Default: HelloWorld-simple amqp://localhost:5672 amq.topic
Command line:
HelloWorld-simple [brokerUrl [brokerEndpointAddress]]
Default:
HelloWorld-simple amqp://localhost:5672 amq.topic
helloworld-simple 示例调用
HelloWorld-simple
$ HelloWorld-simple
Hello world!
默认情况下,该程序连接到 localhost:5672 上运行的代理。在命令行中明确指定主机和端口,以及 AMQP 端点地址:
HelloWorld-simple amqp://someotherhost.com:5672 endpointname
$ HelloWorld-simple amqp://someotherhost.com:5672 endpointname
默认情况下,该程序将其消息发送到 amq.topic
。在某些 Amqp 代理中,amq.topic 是一个预定义的端点地址,它立即可用,没有代理配置。如果代理中没有这个地址,则使用代理管理工具创建它。