Interface MessagePayloadProcessor

public interface MessagePayloadProcessor
The processor to process a message payload. It's responsible to convert the raw buffer to some messages, then trigger some callbacks so that consumer can consume these messages and handle the exception if it existed. The most important part is to decode the raw buffer. After that, we can call MessagePayloadContext.getMessageAt(int, int, org.apache.pulsar.client.api.MessagePayload, boolean, org.apache.pulsar.client.api.Schema<T>) or MessagePayloadContext.asSingleMessage(org.apache.pulsar.client.api.MessagePayload, org.apache.pulsar.client.api.Schema<T>) to construct Message for consumer to consume. Since we need to pass the MessagePayload object to these methods, we can use MessagePayloadFactory.DEFAULT to create it or just reuse the payload argument.
  • Field Details

  • Method Details

    • process

      <T> void process(MessagePayload payload, MessagePayloadContext context, Schema<T> schema, Consumer<Message<T>> messageConsumer) throws Exception
      Process the message payload.
      Type Parameters:
      T -
      payload - the payload whose underlying buffer is a Netty ByteBuf
      context - the message context that contains the message format information and methods to create a message
      schema - the message's schema
      messageConsumer - the callback to consume each message