【问题标题】:Azure service bus Connection abortedAzure 服务总线连接中止
【发布时间】:2023-01-19 12:14:33
【问题描述】:

我的应用程序部署在 azure 云中,具有 Azure 服务总线配置。 当我跟踪日志时,我可以在信息、警告和错误中看到许多与连接中止相关的日志。 com.azure.core.amqp.exception.AmqpException: org.apache.qpid.proton.engine.TransportException: 连接中止

尝试跟踪这个错误,但没有找到任何具体的解决方案,为什么这个日志来了。

【问题讨论】:

    标签: sdk azureservicebus


    【解决方案1】:
    • 在这里使用以下方式,在将 azure 服务总线与 spring boot JMS 一起使用时我没有收到任何异常

    • 现在我在 application.properties 文件中配置服务总线,如下所示:

    spring.jms.servicebus.connection-string=Endpoint=<Connection String>
    spring.jms.servicebus.pricing-tier=<Price Tier>
    
    • 现在我有简单的 Rest api,它只向 Azure 服务总线发送消息
    @RestController  
    public class PostController {
        private static final String DESTINATION_NAME = "<queueName>";
        
        @Autowired  
        private JmsTemplate jmsTemplate;
        @PostMapping("/messages")  
        public String postMessage(@RequestParam String message) {  
        jmsTemplate.convertAndSend(DESTINATION_NAME, new Test(message));  
         return message;  
        }
    }
    

    这里 Test 只是一个带有变量 name 的类,我们正在发送类 Test 的对象

    输出:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多