duxugang opened a new issue, #20452:
URL: https://github.com/apache/pulsar/issues/20452

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   Server: 2.10
   Java SDK: 2.10.2 or 2.11.0
   
   ### Minimal reproduce step
   
   The following code is 100% positive.
   
      private static final String URL = 
"pulsar://xxx.xxx.xxx.xxx:6650,xxx.xxx.xxx.xxx:6650";
   
       public static void main(String[] args) throws Exception {
           new Thread(() -> {
               try {
                   PulsarClient subClient = getSubClient();
                   ConsumerBuilder<byte[]> consumerBuilder = 
subClient.newConsumer();
                   Consumer<byte[]> subscribe = 
consumerBuilder.subscriptionName("tp1:SUB").topic("tp1").subscriptionType(SubscriptionType.Exclusive).subscribe();
   
                   while (true) {
                       Message<byte[]> receive = subscribe.receive();
                       subscribe.acknowledge(receive);
                       System.out.println(System.currentTimeMillis() + 
"---收到消息:" + new String(receive.getData()));
                   }
               } catch (Exception e) {
                   throw new RuntimeException(e);
               }
   
           }).start();
           new Thread(() -> {
               try {
                   PulsarClient pubClient = getPubClient();
                   Producer<byte[]> producer = 
pubClient.newProducer().topic("tp1").create();
                   for (int i = 0; i < 100; i++) {
                       TimeUnit.SECONDS.sleep(1);
                       System.out.println(System.currentTimeMillis() + 
"---发送消息:" + i);
                       producer.newMessage().deliverAfter(3, 
TimeUnit.MINUTES).value(("第" + i + "条dsjkdkdjk").getBytes()).send();
                   }
               } catch (PulsarClientException e) {
                   throw new RuntimeException(e);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               } catch (Exception e) {
                   throw new RuntimeException(e);
               }
           }).start();
           LockSupport.park();
       }
   
       public static PulsarClient getPubClient() throws Exception {
           return PulsarClient.builder().
                   
authentication("org.apache.pulsar.client.impl.auth.AuthenticationToken",
                           
"eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjaHRnOXRidTpuZXcydGVzdDpQVUIifQ.VIlHrzj_aPVdpY0JtC3geGJ1z88HY7xrKcKLgRtauXKJOLqZbVw1CjSQASOQfulpD4bOJaMyb3o164ESapKdCiFf6YV74-IAXHnqwhtrvEnbgE7doMcjmj0iYcPlQ8Rhc7_B49evqDauX15d7USZF9Y38orHKtXA6h2wNHpHB-7tM4aWPekipiQhLP-fyWh2W6KmL2hobPcPj2_tgbrXqbblUVowvE8sntGLW71vdQovaaVsFpnIU8be7HEhjYqShdXo0EXP-4l6xwyy_blsHf7TtewxS_XDgyQiITxmQ37AHXhjH5JmIRnrAUcLwsJO-FXkrGeGzO2Axdg80hCRKA")
                   .serviceUrl(URL).build();
       }
   
       public static PulsarClient getSubClient() throws Exception {
           return PulsarClient.builder().
                   
authentication("org.apache.pulsar.client.impl.auth.AuthenticationToken",
                           
"eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjaHRnOXRidTpuZXcydGVzdDpTVUIifQ.cRolydDo-hgVdZ51BFq02rmec5b9sZ24_nyVbAhkZiLU_OGpGs97lEVK2rBjEb5dCckpHN5nhbxSLMUqVSAigx4aQphzpFC43sIA7NzY8cLfvEl95Eg6mK7GK_I3Qefo-ZlRP-Fi-F_LdEIBXD5x8jyzh9seicOabB9ARFVxQO6eZzD3_M1oXIDhn3-ZYc98WxBTSxEnmEToKaYKJ5cfSrKwMtMUuLEnVIzQ4cKjBPyDoTPyA090kEbJR3edvK-Mn7bhFpolf86slgF9p-cBrjEwS1DYt2c6zjYgYy7EwcuEQZ3MmhvJoWGB0ZZUqGVeswjHvc57al0MCWnDas_new")
                   .serviceUrl(URL).build();
       }`
   
   ### What did you expect to see?
   
   The message was delayed by three minutes
   
   ### What did you see instead?
   
   The message was sent out and was immediately consumed
   
   results:
   1685589969451---发送消息:0
   1685589969490---收到消息:第0条dsjkdkdjk
   1685589970527---发送消息:1
   1685589970548---收到消息:第1条dsjkdkdjk
   1685589971548---发送消息:2
   1685589971573---收到消息:第2条dsjkdkdjk
   1685589972574---发送消息:3
   1685589972593---收到消息:第3条dsjkdkdjk
   1685589973593---发送消息:4
   1685589973611---收到消息:第4条dsjkdkdjk
   1685589974611---发送消息:5
   1685589974629---收到消息:第5条dsjkdkdjk
   1685589975629---发送消息:6
   1685589975647---收到消息:第6条dsjkdkdjk
   1685589976647---发送消息:7
   1685589976667---收到消息:第7条dsjkdkdjk
   1685589977668---发送消息:8
   1685589977684---收到消息:第8条dsjkdkdjk
   1685589978687---发送消息:9
   1685589978705---收到消息:第9条dsjkdkdjk
   1685589979705---发送消息:10
   1685589979731---收到消息:第10条dsjkdkdjk
                    ....
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
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