bus java_通过 Java 使用 Azure 服务总线队列 (azure-messaging-servicebus) - Azure Service Bus | Microsoft Docs...

您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

向 Azure 服务总线队列发送消息并从中接收消息 (Java)Send messages to and receive messages from Azure Service Bus queues (Java)

11/09/2020

本文内容

在本快速入门中,你将创建一个 Java 应用,以便向 Azure 服务总线队列发送消息,并从中接收消息。In this quickstart, you'll create a Java app to send messages to and receive messages from an Azure Service Bus queue.

重要

本快速入门使用新的 azure-messaging-servicebus 包。This quickstart uses the new azure-messaging-servicebus package. 有关使用旧 azure-servicebus 包的快速入门,请参阅使用 azure-servicebus 发送和接收消息。For a quickstart that uses the old azure-servicebus package, see Send and receive messages using azure-servicebus.

先决条件Prerequisites

Azure 订阅。An Azure subscription. 若要完成本教程,需要一个 Azure 帐户。To complete this tutorial, you need an Azure account. You can activate your MSDN subscriber benefits or sign up for a free account.

如果没有可使用的队列,请遵循使用 Azure 门户创建服务总线队列一文来创建队列。If you don't have a queue to work with, follow steps in the Use Azure portal to create a Service Bus queue article to create a queue. 记下服务总线命名空间的连接字符串以及创建的队列的名称 。Note down the connection string for your Service Bus namespace and the name of the queue you created.

如果使用 Eclipse,则可安装 Azure Toolkit for Eclipse,其中包含用于 Java 的 Azure SDK。If you're using Eclipse, you can install the Azure Toolkit for Eclipse that includes the Azure SDK for Java. 然后,可将“适用于 Java 的 Microsoft Azure 库”添加到项目 。You can then add the Microsoft Azure Libraries for Java to your project.

向队列发送消息Send messages to a queue

在本部分中,你将创建一个 Java 控制台项目,并添加代码以将消息发送到之前创建的队列。In this section, you'll create a Java console project, and add code to send messages to the queue that you created earlier.

创建 Java 控制台项目Create a Java console project

使用 Eclipse 或所选工具创建 Java 项目。Create a Java project using Eclipse or a tool of your choice.

配置应用程序以使用服务总线Configure your application to use Service Bus

添加对 Azure 服务总线库的引用。Add a reference to Azure Service Bus library. Maven 中心存储库中提供了服务总线的 Java 客户端库。The Java client library for Service Bus is

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值