KannarFr edited a comment on issue #5006: AvroSchema in pulsar function 
producer doesn't output correct message
URL: https://github.com/apache/pulsar/issues/5006#issuecomment-524120067
 
 
   @sijie @jerrypeng 
   
   When I run this:
   
   ```
   public static void main(String[] args) {
     try {
       PulsarClient client = PulsarClient.builder()
           .authentication(new AuthenticationToken("<TOKEN>"))
           .serviceUrl("<URL>")
           .build();
   
       AvroSchema<ApplicationLog> schema = AvroSchema.of(ApplicationLog.class);
   
       Producer<ApplicationLog> producer = client.newProducer(schema)
           .topic("persistent://public/default/test")
           .sendTimeout(10, TimeUnit.SECONDS)
           .create();
       Consumer<ApplicationLog> consumer = client.newConsumer(schema)
           .topic("persistent://public/default/test")
           .subscriptionName("test")
           .subscribe();
   
       ApplicationLog app = new ApplicationLog();
       producer.send(app);
       Message<ApplicationLog> msg = consumer.receive();
       try {
         System.out.println("hello");
         System.out.println(msg);
         System.out.println(msg.getSchemaVersion());
         System.out.println(msg.getData());
         System.out.println(msg.getProperties());
         System.out.println(msg.getValue());
         System.out.println("bye");
         consumer.acknowledge(msg);
       } catch (Exception e) {
         consumer.negativeAcknowledge(msg);
       }
     } catch (Exception e) {
       System.out.println(e.toString());
     }
   }
   ```
   
   I got:
   
   ```
   hello
   org.apache.pulsar.client.impl.MessageImpl@1ecee32c
   [B@4372b9b6
   [B@232a7d73
   {}
   ```
   
   And thats it, it stucks to the getValue(). No exception, just stucked.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to