qiaofazhan commented on issue #21900:
URL: https://github.com/apache/pulsar/issues/21900#issuecomment-1891651886

   > > thanks, but I use concurrentHap for that problem . And there are some 
other dump info:
   > 
   > Yes, indeed. Which Apache EventMesh version do you use? Custom fork?
   
   
    Custom fork from EventMesh v1.8.0 ;
    Now, I try to create a producer in a practical asynchronous way; Add a 
timeout wait when getting the producer object
   ========
    private Producer<byte[]> createProducer(String topic) {
           long start = System.currentTimeMillis();
           log.info("init create producer start:");
          Producer<byte[]> producer ;
           CompletableFuture<Producer<byte[]>> 
future=this.pulsarClient.newProducer()
                   .topic(topic)
                   .enableBatching(false)  //enableBatch  always happen timeout 
in prod env(The timeout looks like it only took 1 millisecond); there are 
similar issures in pulsar community about this;
                   //.batchingMaxPublishDelay(15, TimeUnit.MILLISECONDS)
                   .sendTimeout(8, TimeUnit.SECONDS)
                  // .batchingMaxMessages(100)
                   .maxPendingMessages(100)
                   .createAsync();
           try {
               producer = future.get(60,TimeUnit.SECONDS);
           } catch (Exception ex) {
               log.error("init create producer error ,cost 
time="+(System.currentTimeMillis()-start)/1000);
               log.error(">>>> create pulsar producer 
error",unwrapCompletionException(ex));
               reInitPulsarClient(topic);
               throw new ConnectorRuntimeException(
                       String.format("Failed to create pulsar producer for %s 
with exception: %s", topic, ex.getMessage()));
           }
           return producer;
       }


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to