|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object com.taobao.metamorphosis.client.consumer.SimpleMessageConsumer
public class SimpleMessageConsumer
消息消费者基类
嵌套类摘要 | |
---|---|
static class |
SimpleMessageConsumer.DropPolicy
Created with IntelliJ IDEA. |
static class |
SimpleMessageConsumer.LocalRecoverPolicy
Created with IntelliJ IDEA. |
构造方法摘要 | |
---|---|
SimpleMessageConsumer(MetaMessageSessionFactory messageSessionFactory,
RemotingClientWrapper remotingClient,
ConsumerConfig consumerConfig,
ConsumerZooKeeper consumerZooKeeper,
ProducerZooKeeper producerZooKeeper,
SubscribeInfoManager subscribeInfoManager,
RecoverManager recoverManager,
OffsetStorage offsetStorage,
LoadBalanceStrategy loadBalanceStrategy)
|
方法摘要 | |
---|---|
void |
appendCouldNotProcessMessage(Message message)
处理无法被客户端消费的消息 |
void |
completeSubscribe()
使得已经订阅的topic生效,此方法仅能调用一次,再次调用无效并将抛出异常 |
MessageIterator |
fetch(FetchRequest fetchRequest,
long timeout,
TimeUnit timeUnit)
抓取消息 |
MessageIterator |
get(String topic,
Partition partition,
long offset,
int maxSize)
获取指定topic和分区下面的消息,默认超时10秒 |
MessageIterator |
get(String topic,
Partition partition,
long offset,
int maxSize,
long timeout,
TimeUnit timeUnit)
获取指定topic和分区下面的消息,在指定时间内没有返回则抛出异常 |
ConsumerConfig |
getConsumerConfig()
返回消费者配置 |
FetchManager |
getFetchManager()
|
ConsumerMessageFilter |
getMessageFilter(String topic)
|
MessageListener |
getMessageListener(String topic)
返回topic对应的消息监听器 |
OffsetStorage |
getOffsetStorage()
返回此消费者使用的offset存储器,可共享给其他消费者 |
MetaMessageSessionFactory |
getParent()
|
RejectConsumptionHandler |
getRejectConsumptionHandler()
Returns current RejectConsumptionHandler |
long |
offset(FetchRequest fetchRequest)
查询offset |
void |
setRejectConsumptionHandler(RejectConsumptionHandler rejectConsumptionHandler)
Sets RejectConsumptionHandler for this consumer. |
void |
setSubscriptions(Collection<com.taobao.metamorphosis.client.consumer.Subscription> subscriptions)
批量订阅消息,请注意,调用此方法并不会使订阅关系立即生效,只有在调用complete方法后才生效。 |
void |
shutdown()
停止消费者 |
MessageConsumer |
subscribe(String topic,
int maxSize,
MessageListener messageListener)
订阅指定的消息,传入MessageListener,当有消息达到的时候主动通知MessageListener,请注意, 调用此方法并不会使订阅关系立即生效, 只有在调用complete方法后才生效,此方法可做链式调用 |
MessageConsumer |
subscribe(String topic,
int maxSize,
MessageListener messageListener,
ConsumerMessageFilter filter)
订阅指定的消息,传入MessageListener和ConsumerMessageFilter, 当有消息到达并且ConsumerMessageFilter #accept返回true的时候,主动通知MessageListener该条消息,请注意, 调用此方法并不会使订阅关系立即生效, 只有在调用complete方法后才生效,此方法可做链式调用 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public SimpleMessageConsumer(MetaMessageSessionFactory messageSessionFactory, RemotingClientWrapper remotingClient, ConsumerConfig consumerConfig, ConsumerZooKeeper consumerZooKeeper, ProducerZooKeeper producerZooKeeper, SubscribeInfoManager subscribeInfoManager, RecoverManager recoverManager, OffsetStorage offsetStorage, LoadBalanceStrategy loadBalanceStrategy)
方法详细信息 |
---|
public MetaMessageSessionFactory getParent()
public FetchManager getFetchManager()
public OffsetStorage getOffsetStorage()
MessageConsumer
复制的描述
MessageConsumer
中的 getOffsetStorage
public void shutdown() throws MetaClientException
MessageConsumer
复制的描述
MessageConsumer
中的 shutdown
Shutdownable
中的 shutdown
MetaClientException
public MessageConsumer subscribe(String topic, int maxSize, MessageListener messageListener) throws MetaClientException
MessageConsumer
复制的描述
MessageConsumer
中的 subscribe
topic
- 订阅的topicmaxSize
- 订阅每次接收的最大数据大小messageListener
- 消息监听器
MetaClientException
public MessageConsumer subscribe(String topic, int maxSize, MessageListener messageListener, ConsumerMessageFilter filter) throws MetaClientException
MessageConsumer
复制的描述
MessageConsumer
中的 subscribe
topic
- 订阅的topicmaxSize
- 订阅每次接收的最大数据大小
MetaClientException
public void appendCouldNotProcessMessage(Message message) throws IOException
InnerConsumer
复制的描述
InnerConsumer
中的 appendCouldNotProcessMessage
IOException
public void completeSubscribe() throws MetaClientException
MessageConsumer
复制的描述
MessageConsumer
中的 completeSubscribe
MetaClientException
public MessageListener getMessageListener(String topic)
InnerConsumer
复制的描述
InnerConsumer
中的 getMessageListener
public ConsumerMessageFilter getMessageFilter(String topic)
InnerConsumer
中的 getMessageFilter
public long offset(FetchRequest fetchRequest) throws MetaClientException
InnerConsumer
复制的描述
InnerConsumer
中的 offset
MetaClientException
public MessageIterator fetch(FetchRequest fetchRequest, long timeout, TimeUnit timeUnit) throws MetaClientException, InterruptedException
InnerConsumer
复制的描述
InnerConsumer
中的 fetch
MetaClientException
InterruptedException
public void setSubscriptions(Collection<com.taobao.metamorphosis.client.consumer.Subscription> subscriptions) throws MetaClientException
MessageConsumer
复制的描述
MessageConsumer
中的 setSubscriptions
MetaClientException
public MessageIterator get(String topic, Partition partition, long offset, int maxSize, long timeout, TimeUnit timeUnit) throws MetaClientException, InterruptedException
MessageConsumer
复制的描述
MessageConsumer
中的 get
MetaClientException
InterruptedException
public RejectConsumptionHandler getRejectConsumptionHandler()
MessageConsumer
复制的描述
MessageConsumer
中的 getRejectConsumptionHandler
public void setRejectConsumptionHandler(RejectConsumptionHandler rejectConsumptionHandler)
MessageConsumer
复制的描述
MessageConsumer
中的 setRejectConsumptionHandler
public ConsumerConfig getConsumerConfig()
MessageConsumer
复制的描述
InnerConsumer
中的 getConsumerConfig
MessageConsumer
中的 getConsumerConfig
public MessageIterator get(String topic, Partition partition, long offset, int maxSize) throws MetaClientException, InterruptedException
MessageConsumer
复制的描述
MessageConsumer
中的 get
MetaClientException
InterruptedException
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |