|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
public interface MQPullConsumer
消费者,主动方式消费
| 方法摘要 | |
|---|---|
long |
fetchConsumeOffset(MessageQueue mq,
boolean fromStore)
获取消费进度,返回-1表示出错 |
Set<MessageQueue> |
fetchMessageQueuesInBalance(String topic)
根据topic获取MessageQueue,以均衡方式在组内多个成员之间分配 |
PullResult |
pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums)
指定队列,主动拉取消息,即使没有消息,也立刻返回 |
void |
pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
PullCallback pullCallback)
|
PullResult |
pullBlockIfNotFound(MessageQueue mq,
String subExpression,
long offset,
int maxNums)
指定队列,主动拉取消息,如果没有消息,则broker阻塞一段时间再返回(时间可配置) broker阻塞期间,如果有消息,则立刻将消息返回 |
void |
pullBlockIfNotFound(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
PullCallback pullCallback)
|
void |
registerMessageQueueListener(String topic,
MessageQueueListener listener)
注册监听队列变化的listener对象 |
void |
shutdown()
关闭服务 |
void |
start()
启动服务 |
void |
updateConsumeOffset(MessageQueue mq,
long offset)
更新消费进度 只是更新Consumer缓存中的数据,如果是广播模式,则定时更新到本地存储 如果是集群模式,则定时更新到远端Broker P.S. |
| 从接口 com.alibaba.rocketmq.client.consumer.MQConsumer 继承的方法 |
|---|
fetchSubscribeMessageQueues, sendMessageBack |
| 从接口 com.alibaba.rocketmq.client.MQAdmin 继承的方法 |
|---|
createTopic, earliestMsgStoreTime, maxOffset, minOffset, queryMessage, searchOffset, viewMessage |
| 方法详细信息 |
|---|
void start()
throws MQClientException
MQClientExceptionvoid shutdown()
void registerMessageQueueListener(String topic,
MessageQueueListener listener)
topic - listener - 一旦发生变化,客户端会主动回调listener对象
PullResult pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums)
throws MQClientException,
RemotingException,
MQBrokerException,
InterruptedException
mq - 指定具体要拉取的队列subExpression - 订阅过滤表达式字符串,broker依据此表达式进行过滤。目前只支持或运算offset - 从指定队列哪个位置开始拉取maxNums - 一次最多拉取条数
MQClientException
InterruptedException
MQBrokerException
RemotingException
void pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
PullCallback pullCallback)
throws MQClientException,
RemotingException,
InterruptedException
MQClientException
RemotingException
InterruptedException
PullResult pullBlockIfNotFound(MessageQueue mq,
String subExpression,
long offset,
int maxNums)
throws MQClientException,
RemotingException,
MQBrokerException,
InterruptedException
mq - 指定具体要拉取的队列subExpression - 订阅过滤表达式字符串,broker依据此表达式进行过滤。目前只支持或运算offset - 从指定队列哪个位置开始拉取maxNums - 一次最多拉取条数
InterruptedException
MQBrokerException
RemotingException
MQClientException
void pullBlockIfNotFound(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
PullCallback pullCallback)
throws MQClientException,
RemotingException,
InterruptedException
MQClientException
RemotingException
InterruptedException
void updateConsumeOffset(MessageQueue mq,
long offset)
throws MQClientException
mq - offset -
MQClientException
long fetchConsumeOffset(MessageQueue mq,
boolean fromStore)
throws MQClientException
mq - fromStore -
MQClientException
Set<MessageQueue> fetchMessageQueuesInBalance(String topic)
throws MQClientException
topic - 消息Topic
MQClientException
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||