接口的使用
org.apache.pulsar.client.api.Message
-
使用Message的程序包 程序包 说明 org.apache.pulsar.client.api Pulsar Client API.org.apache.pulsar.client.api.interceptor Pulsar interceptors. -
-
org.apache.pulsar.client.api中Message的使用
返回Message的org.apache.pulsar.client.api中的方法 修饰符和类型 方法 说明 Message<T>ConsumerInterceptor. beforeConsume(Consumer<T> consumer, Message<T> message)This is called just before the message is returned byConsumer.receive(),MessageListener.received(Consumer, Message)or theCompletableFuturereturned byConsumer.receiveAsync()completes.Message<T>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.Message<T>Reader. readNext()Read the next message in the topic.Message<T>Reader. readNext(int timeout, java.util.concurrent.TimeUnit unit)Read the next message in the topic waiting for a maximum time.Message<T>Consumer. receive()Receives a single message.Message<T>Consumer. receive(int timeout, java.util.concurrent.TimeUnit unit)Receive a single message.返回变量类型为Message的类型的org.apache.pulsar.client.api中的方法 修饰符和类型 方法 说明 java.util.concurrent.CompletableFuture<Message<T>>Reader. readNextAsync()Read asynchronously the next message in the topic.java.util.concurrent.CompletableFuture<Message<T>>Consumer. receiveAsync()Receive a single message参数类型为Message的org.apache.pulsar.client.api中的方法 修饰符和类型 方法 说明 voidConsumer. acknowledge(Message<?> message)Acknowledge the consumption of a single message.java.util.concurrent.CompletableFuture<java.lang.Void>Consumer. acknowledgeAsync(Message<?> message)Asynchronously acknowledge the consumption of a single message.voidConsumer. acknowledgeCumulative(Message<?> message)Acknowledge the reception of all the messages in the stream up to (and including) the provided message.java.util.concurrent.CompletableFuture<java.lang.Void>Consumer. acknowledgeCumulativeAsync(Message<?> message)Asynchronously Acknowledge the reception of all the messages in the stream up to (and including) the provided message.Message<T>ConsumerInterceptor. beforeConsume(Consumer<T> consumer, Message<T> message)This is called just before the message is returned byConsumer.receive(),MessageListener.received(Consumer, Message)or theCompletableFuturereturned byConsumer.receiveAsync()completes.Message<T>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 intMessageRouter. choosePartition(Message<?> msg)已过时。since 1.22.0.default intMessageRouter. choosePartition(Message<?> msg, TopicMetadata metadata)Choose a partition based on msg and the topic metadata.voidConsumer. negativeAcknowledge(Message<?> message)Acknowledge the failure to process a single message.voidProducerInterceptor. onSendAcknowledgement(Producer<T> producer, Message<T> message, MessageId msgId, java.lang.Throwable exception)已过时。This method is called when the message sent to the broker has been acknowledged, or when sending the message fails.voidMessageListener. received(Consumer<T> consumer, Message<T> msg)This method is called whenever a new message is received.voidReaderListener. received(Reader<T> reader, Message<T> msg)This method is called whenever a new message is received.voidConsumer. reconsumeLater(Message<?> message, long delayTime, java.util.concurrent.TimeUnit unit)reconsumeLater the consumption ofMessages.java.util.concurrent.CompletableFuture<java.lang.Void>Consumer. reconsumeLaterAsync(Message<?> message, long delayTime, java.util.concurrent.TimeUnit unit)Asynchronously reconsumeLater the consumption of a single message.voidConsumer. reconsumeLaterCumulative(Message<?> message, long delayTime, java.util.concurrent.TimeUnit unit)reconsumeLater the reception of all the messages in the stream up to (and including) the provided message.java.util.concurrent.CompletableFuture<java.lang.Void>Consumer. reconsumeLaterCumulativeAsync(Message<?> message, long delayTime, java.util.concurrent.TimeUnit unit)Asynchronously ReconsumeLater the reception of all the messages in the stream up to (and including) the provided message. -
org.apache.pulsar.client.api.interceptor中Message的使用
返回Message的org.apache.pulsar.client.api.interceptor中的方法 修饰符和类型 方法 说明 MessageProducerInterceptor. beforeSend(Producer producer, Message message)This is called fromProducer.send(Object)andProducer.sendAsync(Object)methods, before send the message to the brokers.MessageProducerInterceptorWrapper. beforeSend(Producer producer, Message message)参数类型为Message的org.apache.pulsar.client.api.interceptor中的方法 修饰符和类型 方法 说明 MessageProducerInterceptor. beforeSend(Producer producer, Message message)This is called fromProducer.send(Object)andProducer.sendAsync(Object)methods, before send the message to the brokers.MessageProducerInterceptorWrapper. beforeSend(Producer producer, Message message)booleanProducerInterceptor. eligible(Message message)Check whether the interceptor is eligible for this message.booleanProducerInterceptorWrapper. eligible(Message message)voidProducerInterceptor. onSendAcknowledgement(Producer producer, Message message, MessageId msgId, java.lang.Throwable exception)This method is called when the message sent to the broker has been acknowledged, or when sending the message fails.voidProducerInterceptorWrapper. onSendAcknowledgement(Producer producer, Message message, MessageId msgId, java.lang.Throwable exception)
-