Skip to content
Advertisement

IllegalStateException: Cannot Subscrie.Processor is already terminated

I created a new eventhub and trying to publish messages to eventHubA. When I am trying to send messages to eventhub , I get the following error:

java.lang.IllegalStateException: namespace[xxxxx] entityPath[xxxxx]: Cannot subscribe. Processor is already terminated at com.azure.core.amqp.implementation.AmqpChannelProcessor.subscribe(AmqpChannelProcessor.java:217)

Below is the code snippet i am using:

JavaScript

I have defined the eventhubProducerClient as a Bean.

JavaScript

Below is my gradle dependencies

JavaScript

Advertisement

Answer

From the follow-up question, it would appear that the root cause has been confirmed as the producer.close() call in the send method.

Since it appears that he producer is being managed as a singleton by the application, the mitigation would be to call close at the point when events are no longer going to be published, such as when the application is shutting down.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement