接口 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 callMessagePayloadContext.getMessageAt(int, int, org.apache.pulsar.client.api.MessagePayload, boolean, org.apache.pulsar.client.api.Schema<T>)
orMessagePayloadContext.asSingleMessage(org.apache.pulsar.client.api.MessagePayload, org.apache.pulsar.client.api.Schema<T>)
to constructMessage
for consumer to consume. Since we need to pass theMessagePayload
object to these methods, we can useMessagePayloadFactory.DEFAULT
to create it or just reuse the payload argument.
-
-
字段概要
字段 修饰符和类型 字段 说明 static MessagePayloadProcessor
DEFAULT
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 <T> void
process(MessagePayload payload, MessagePayloadContext context, Schema<T> schema, java.util.function.Consumer<Message<T>> messageConsumer)
Process the message payload.
-
-
-
字段详细资料
-
DEFAULT
static final MessagePayloadProcessor DEFAULT
-
-
方法详细资料
-
process
<T> void process(MessagePayload payload, MessagePayloadContext context, Schema<T> schema, java.util.function.Consumer<Message<T>> messageConsumer) throws java.lang.Exception
Process the message payload.- 类型参数:
T
-- 参数:
payload
- the payload whose underlying buffer is a Netty ByteBufcontext
- the message context that contains the message format information and methods to create a messageschema
- the message's schemamessageConsumer
- the callback to consume each message- 抛出:
java.lang.Exception
-
-