microsoft / azure-spring-boot

Spring Boot Starters for Azure services
MIT License
376 stars 460 forks source link

[BUG] Prevent "The MessageProducer was closed due to an unrecoverable error" #817

Closed carcaryn closed 4 weeks ago

carcaryn commented 4 years ago

Hi everyone, I've this problem with Azure Jms Spring Library. After few times of innactivity, when I try to send a message to a topic, the library throw me this exception: "The MessageProducer was closed due to an unrecoverable error; nested exception is javax.jms.IllegalStateException: The MessageProducer was closed due to an unrecoverable error".

How can I prevent this problem? Is a configuration problem? I know that azure close connection after ten minutes of inactivity, but how can I resolve the MessageProducer error in my project? Thanx

Project azure-servicebus-jms-spring-boot-starter Version 2.1.7

yiliuTo commented 1 year ago

@Saljack we agree that using pool connection facotry for such case should not be announced as a fix, a fix should be able to enable send/receive messages normally and smoothly without exceptions or without extra configuration. Our current plan for this issue that:

  1. we will validate the usage of pool connection factory and give clear introducation and instruction for it in our reference doc/quickstart/samples.
  2. we will investigate to solve this issue instead of providing a workaround only. And the process will be tracked in https://github.com/Azure/azure-sdk-for-java/issues/31966
dmuley17 commented 6 months ago

I had the same issue and I fixed it by enabling pool in spring boot

spring:
  jms:
    servicebus:
      connection-string: Endpoint=sb://*******w=
      pricing-tier: standard
      pool:
        enabled: true

More information

https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/spring-jms-troubleshooting-guide#the-messageproducer-was-closed-due-to-an-unrecoverable-error

Netyyyy commented 4 weeks ago

This issue has been inactive for a while. We‘re going to close it. If you have any questions, please open an issue on https://github.com/Azure/azure-sdk-for-java