接口的使用
org.apache.pulsar.client.api.Consumer
使用Consumer的程序包
-
org.apache.pulsar.client.api中Consumer的使用
修饰符和类型方法说明ConsumerBuilder.subscribe()Finalize theConsumercreation by subscribing to the topic.返回变量类型为Consumer的类型的org.apache.pulsar.client.api中的方法修饰符和类型方法说明ConsumerBuilder.subscribeAsync()Finalize theConsumercreation by subscribing to the topic in asynchronous mode.参数类型为Consumer的org.apache.pulsar.client.api中的方法修饰符和类型方法说明voidConsumerEventListener.becameActive(Consumer<?> consumer, int partitionId) Notified when the consumer group is changed, and the consumer becomes the active consumer.voidConsumerEventListener.becameInactive(Consumer<?> consumer, int partitionId) Notified when the consumer group is changed, and the consumer is still inactive or becomes inactive.ConsumerInterceptor.beforeConsume(Consumer<T> consumer, Message<T> message) This is called just before the message is returned byreceive(),MessageListener.received(Consumer, Message)or theCompletableFuturereturned byreceiveAsync()completes.voidConsumerInterceptor.onAcknowledge(Consumer<T> consumer, MessageId messageId, Throwable exception) This is called consumer sends the acknowledgment to the broker.voidConsumerInterceptor.onAcknowledgeCumulative(Consumer<T> consumer, MessageId messageId, Throwable exception) This is called consumer send the cumulative acknowledgment to the broker.voidConsumerInterceptor.onAckTimeoutSend(Consumer<T> consumer, Set<MessageId> messageIds) This method will be called when a redelivery from an acknowledge timeout occurs.voidConsumerInterceptor.onNegativeAcksSend(Consumer<T> consumer, Set<MessageId> messageIds) This method will be called when a redelivery from a negative acknowledge occurs.default voidMessageListener.reachedEndOfTopic(Consumer<T> consumer) Get the notification when a topic is terminated.voidThis method is called whenever a new message is received.