Here is the following scenario. I have a Event Producer which publishes events. I referred the mircosoft document https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-send
According to my usecase, I have a bean which would create the eventhubProducerClient connection at start of my application. However , the producer.close() in my send method (from above documentation) is called after each event is sent. So, this leads to close of my producer and when I would like to send the next event, there is already an exception that the producer is terminated.
What is the best way to handle the producer.close (). can I leave the producer open ? Wouldnt that cause a memory leak ? Is there a strategy on how I can handle this ? any lead would be helpful
thank you