Hi Kafka Dev Team, *java.lang.* *IllegalStateException: Cannot send after the producer is closed.*
The above seems to bug. If the ProducerRecord is in flight within send method is execute and another thread seems to shutdown in the middle of flight will get error. Thanks, Bhavesh On Sun, Oct 5, 2014 at 7:15 PM, Bhavesh Mistry <mistry.p.bhav...@gmail.com> wrote: > Hi Kafka Dev Team, > > The use case is that we need to know producer state in background Threads > and so we can submit the message. > > This seems to a bug in trunk code. I have notice that KafkaProducer > itself does not have close state and inflight message will encounter > following issues. Should I file bug for this issue ? > > java.lang.IllegalStateException: Cannot send after the producer is closed. > at > org.apache.kafka.clients.producer.internals.RecordAccumulator.append(RecordAccumulator.java:136) > at > org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:237) > ................................................. > at java.util.TimerThread.mainLoop(Timer.java:555) > at java.util.TimerThread.run(Timer.java:505) > > Thanks, > > Bhavesh > > On Sun, Oct 5, 2014 at 3:30 PM, Bhavesh Mistry <mistry.p.bhav...@gmail.com > > wrote: > >> HI Kafka Dev, >> >> I would like to request state check state so I can manage the Life Cycle >> of Producer better. I you guys agree I will file Jira request. I just >> give state of producer can be I would like mange or start (create new >> instance of producer) or restart or close based on state. I just gave >> example, you may add or remove states. >> >> /*** >> >> * API TO CHECK STATE OF PRODUCER >> >> * @Return >> >> >> >> STATE.INIT_IN_PROGRESS >> >> STATE.INIT_DONE >> >> STATE.RUNNING >> >> STATE.CLOSE_REQUESTED >> >> STATE.CLOSE_IN_PROGRESS >> >> STATE.CLOSED >> >> */ >> >> public State getCurrentState(); >> >> Thanks, >> >> Bhavesh >> > >