gpt4 book ai didi

java - Azure 服务总线异常

转载 作者:太空宇宙 更新时间:2023-11-04 09:59:16 27 4
gpt4 key购买 nike

我一直在尝试创建一个客户端来连接我的 Azure 服务总线队列。我一直在引用这个文档:
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-java-how-to-use-queues#send-messages-to-a-queue .

我的代码:

public void run() throws Exception {

try {
final String ConnectionString = "<My connection String> ";
final String QueueName = "queue1";
QueueClient sendClient = new QueueClient(new
ConnectionStringBuilder(ConnectionString, QueueName),
ReceiveMode.PEEKLOCK);
System.out.println("sendClient created");
sendClient.close();
} catch(Exception e) {
System.err.println(e);
}
}

在创建客户端时,我收到以下错误:

com.microsoft.azure.servicebus.primitives.ServiceBusException: Error{condition=amqp:connection:framing-error, description='org.apache.qpid.proton.engine.TransportException: connection aborted', info=null}

最佳答案

我认为您的连接未打开。您能否尝试一下queueClient.open()并检查SDK的版本,将其更新到新版本,请引用此链接: https://github.com/Azure/azure-service-bus-java/issues/329

根据上面的链接,这可能是因为一些网络限制。尝试从您自己的网络进行连接并检查它是否有效...

关于java - Azure 服务总线异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53706364/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com