接口的使用
org.apache.pulsar.client.api.Message
使用Message的程序包
程序包
说明
Pulsar Client API.
Pulsar interceptors.
-
org.apache.pulsar.client.api中Message的使用
修饰符和类型方法说明<T> Message<T>
MessagePayloadContext.asSingleMessage
(MessagePayload payload, Schema<T> schema) Convert the given payload to a single message if the entry is not a batch.ConsumerInterceptor.beforeConsume
(Consumer<T> consumer, Message<T> message) This is called just before the message is returned byConsumer.receive()
,MessageListener.received(Consumer, Message)
or theCompletableFuture
returned byConsumer.receiveAsync()
completes.ProducerInterceptor.beforeSend
(Producer<T> producer, Message<T> message) 已过时。This is called fromProducer.send(Object)
andProducer.sendAsync(Object)
methods, before send the message to the brokers.<T> Message<T>
MessagePayloadContext.getMessageAt
(int index, int numMessages, MessagePayload payload, boolean containMetadata, Schema<T> schema) Get the internal single message with a specific index from a payload if the payload is a batch.Reader.readNext()
Read the next message in the topic.Read the next message in the topic waiting for a maximum time.Consumer.receive()
Receives a single message.Receive a single message.返回变量类型为Message的类型的org.apache.pulsar.client.api中的方法修饰符和类型方法说明Reader.readNextAsync()
Read asynchronously the next message in the topic.Consumer.receiveAsync()
Receive a single message参数类型为Message的org.apache.pulsar.client.api中的方法修饰符和类型方法说明void
Consumer.acknowledge
(Message<?> message) Acknowledge the consumption of a single message.Consumer.acknowledgeAsync
(Message<?> message) Asynchronously acknowledge the consumption of a single message.void
Consumer.acknowledgeCumulative
(Message<?> message) Acknowledge the reception of all the messages in the stream up to (and including) the provided message.Consumer.acknowledgeCumulativeAsync
(Message<?> message) Asynchronously Acknowledge the reception of all the messages in the stream up to (and including) the provided message.ConsumerInterceptor.beforeConsume
(Consumer<T> consumer, Message<T> message) This is called just before the message is returned byConsumer.receive()
,MessageListener.received(Consumer, Message)
or theCompletableFuture
returned byConsumer.receiveAsync()
completes.ProducerInterceptor.beforeSend
(Producer<T> producer, Message<T> message) 已过时。This is called fromProducer.send(Object)
andProducer.sendAsync(Object)
methods, before send the message to the brokers.default int
MessageRouter.choosePartition
(Message<?> msg) 已过时。since 1.22.0.default int
MessageRouter.choosePartition
(Message<?> msg, TopicMetadata metadata) Choose a partition based on msg and the topic metadata.void
Consumer.negativeAcknowledge
(Message<?> message) Acknowledge the failure to process a single message.void
ProducerInterceptor.onSendAcknowledgement
(Producer<T> producer, Message<T> message, MessageId msgId, Throwable exception) 已过时。This method is called when the message sent to the broker has been acknowledged, or when sending the message fails.void
This method is called whenever a new message is received.void
This method is called whenever a new message is received.void
Consumer.reconsumeLater
(Message<?> message, long delayTime, TimeUnit unit) reconsumeLater the consumption ofMessages
.void
Consumer.reconsumeLater
(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) reconsumeLater the consumption ofMessages
.Consumer.reconsumeLaterAsync
(Message<?> message, long delayTime, TimeUnit unit) Asynchronously reconsumeLater the consumption of a single message.Consumer.reconsumeLaterAsync
(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) Asynchronously reconsumeLater the consumption of a single message.void
Consumer.reconsumeLaterCumulative
(Message<?> message, long delayTime, TimeUnit unit) reconsumeLater the reception of all the messages in the stream up to (and including) the provided message.Consumer.reconsumeLaterCumulativeAsync
(Message<?> message, long delayTime, TimeUnit unit) Asynchronously ReconsumeLater the reception of all the messages in the stream up to (and including) the provided message.Consumer.reconsumeLaterCumulativeAsync
(Message<?> message, Map<String, String> customProperties, long delayTime, TimeUnit unit) Asynchronously ReconsumeLater the reception of all the messages in the stream up to (and including) the provided message.类型变量类型为Message的org.apache.pulsar.client.api中的方法参数修饰符和类型方法说明<T> void
MessagePayloadProcessor.process
(MessagePayload payload, MessagePayloadContext context, Schema<T> schema, Consumer<Message<T>> messageConsumer) Process the message payload. -
org.apache.pulsar.client.api.interceptor中Message的使用
修饰符和类型方法说明ProducerInterceptor.beforeSend
(Producer producer, Message message) This is called fromProducer.send(Object)
andProducer.sendAsync(Object)
methods, before send the message to the brokers.ProducerInterceptorWrapper.beforeSend
(Producer producer, Message message) 修饰符和类型方法说明ProducerInterceptor.beforeSend
(Producer producer, Message message) This is called fromProducer.send(Object)
andProducer.sendAsync(Object)
methods, before send the message to the brokers.ProducerInterceptorWrapper.beforeSend
(Producer producer, Message message) boolean
Check whether the interceptor is eligible for this message.boolean
void
ProducerInterceptor.onSendAcknowledgement
(Producer producer, Message message, MessageId msgId, Throwable exception) This method is called when the message sent to the broker has been acknowledged, or when sending the message fails.void
ProducerInterceptorWrapper.onSendAcknowledgement
(Producer producer, Message message, MessageId msgId, Throwable exception)