Hello,

 My application uses Pulsar as queues.  A Consumer will read a message from
topic T1, process it and write a message to topic T2. I have several
consumer threads on topic T1 (using a shared subscription).
...
    clientBuilder.listenerThreads(n);
    PulsarClient client = clientBuilder.build();


I am getting the following exception when my program terminates:

org.apache.pulsar.client.api.PulsarClientException$AlreadyClosedException:
Client already closed : state = Closing at
org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:975)
at
org.apache.pulsar.client.impl.ProducerBuilderImpl.create(ProducerBuilderImpl.java:91)
at com.example.messaging.broker.PulsarBroker.publish(PulsarBroker.java:94)

It seems that my application closes the PulsarClient after a thread had
read a message but before it writes to the second topic.

Is there a wait to avoid this issue?
If I call
  consumer.close();
in a Consumer<T> , would it wait for the thread to complete? Or will this
just avoid reading a new message?

-Jorge

Reply via email to