Package org.apache.pulsar.common.api.raw
Class MessageParser
java.lang.Object
org.apache.pulsar.common.api.raw.MessageParser
Helper class to work with a raw Pulsar entry payload.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefinition of an interface to process a raw Pulsar entry payload. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidparseMessage(TopicName topicName, long ledgerId, long entryId, io.netty.buffer.ByteBuf headersAndPayload, MessageParser.MessageProcessor processor, int maxMessageSize) Parse a raw Pulsar entry payload and extract all the individual message that may be included in the batch.static io.netty.buffer.ByteBufuncompressPayloadIfNeeded(TopicName topic, MessageMetadata msgMetadata, io.netty.buffer.ByteBuf payload, long ledgerId, long entryId, int maxMessageSize) static booleanverifyChecksum(TopicName topic, io.netty.buffer.ByteBuf headersAndPayload, long ledgerId, long entryId)
-
Constructor Details
-
MessageParser
public MessageParser()
-
-
Method Details
-
parseMessage
public static void parseMessage(TopicName topicName, long ledgerId, long entryId, io.netty.buffer.ByteBuf headersAndPayload, MessageParser.MessageProcessor processor, int maxMessageSize) throws IOException Parse a raw Pulsar entry payload and extract all the individual message that may be included in the batch. The providedMessageParser.MessageProcessorwill be invoked for each individual message.- Throws:
IOException
-
verifyChecksum
public static boolean verifyChecksum(TopicName topic, io.netty.buffer.ByteBuf headersAndPayload, long ledgerId, long entryId) -
uncompressPayloadIfNeeded
public static io.netty.buffer.ByteBuf uncompressPayloadIfNeeded(TopicName topic, MessageMetadata msgMetadata, io.netty.buffer.ByteBuf payload, long ledgerId, long entryId, int maxMessageSize)
-