public class DefaultMQPullConsumer extends ClientConfig implements MQPullConsumer
| 限定符和类型 | 字段和说明 |
|---|---|
protected DefaultMQPullConsumerImpl |
defaultMQPullConsumerImpl |
SendMessageWithVIPChannelProperty| 构造器和说明 |
|---|
DefaultMQPullConsumer() |
DefaultMQPullConsumer(com.alibaba.rocketmq.remoting.RPCHook rpcHook) |
DefaultMQPullConsumer(String consumerGroup) |
DefaultMQPullConsumer(String consumerGroup,
com.alibaba.rocketmq.remoting.RPCHook rpcHook) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
createTopic(String key,
String newTopic,
int queueNum)
Creates an topic
|
void |
createTopic(String key,
String newTopic,
int queueNum,
int topicSysFlag)
Creates an topic
|
long |
earliestMsgStoreTime(MessageQueue mq)
Gets the earliest stored message time
|
long |
fetchConsumeOffset(MessageQueue mq,
boolean fromStore)
Fetch the offset
|
Set<MessageQueue> |
fetchMessageQueuesInBalance(String topic)
Fetch the message queues according to the topic
|
Set<MessageQueue> |
fetchSubscribeMessageQueues(String topic)
Fetch message queues from consumer cache according to the topic
|
AllocateMessageQueueStrategy |
getAllocateMessageQueueStrategy() |
long |
getBrokerSuspendMaxTimeMillis() |
String |
getConsumerGroup() |
long |
getConsumerPullTimeoutMillis() |
long |
getConsumerTimeoutMillisWhenSuspend() |
DefaultMQPullConsumerImpl |
getDefaultMQPullConsumerImpl() |
int |
getMaxReconsumeTimes() |
MessageModel |
getMessageModel() |
MessageQueueListener |
getMessageQueueListener() |
OffsetStore |
getOffsetStore() |
Set<String> |
getRegisterTopics() |
boolean |
isUnitMode() |
long |
maxOffset(MessageQueue mq)
Gets the max offset
|
long |
minOffset(MessageQueue mq)
Gets the minimum offset
|
PullResult |
pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums)
Pulling the messages,not blocking
|
PullResult |
pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
long timeout)
Pulling the messages in the specified timeout
|
void |
pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
PullCallback pullCallback)
Pulling the messages in a async. way
|
void |
pull(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
PullCallback pullCallback,
long timeout)
Pulling the messages in a async. way
|
PullResult |
pullBlockIfNotFound(MessageQueue mq,
String subExpression,
long offset,
int maxNums)
Pulling the messages,if no message arrival,blocking some time
|
void |
pullBlockIfNotFound(MessageQueue mq,
String subExpression,
long offset,
int maxNums,
PullCallback pullCallback)
Pulling the messages through callback function,if no message arrival,blocking.
|
QueryResult |
queryMessage(String topic,
String key,
int maxNum,
long begin,
long end)
Query messages
|
void |
registerMessageQueueListener(String topic,
MessageQueueListener listener)
Register the message queue listener
|
long |
searchOffset(MessageQueue mq,
long timestamp)
Gets the message queue offset according to some time in milliseconds
be cautious to call because of more IO overhead |
void |
sendMessageBack(MessageExt msg,
int delayLevel)
If consuming failure,message will be send back to the brokers,and delay consuming some time
|
void |
sendMessageBack(MessageExt msg,
int delayLevel,
String brokerName)
If consuming failure,message will be send back to the broker,and delay consuming some time
|
void |
sendMessageBack(MessageExt msg,
int delayLevel,
String brokerName,
String consumerGroup)
If consuming failure,message will be send back to the broker,and delay consuming in some time later.
|
void |
setAllocateMessageQueueStrategy(AllocateMessageQueueStrategy allocateMessageQueueStrategy) |
void |
setBrokerSuspendMaxTimeMillis(long brokerSuspendMaxTimeMillis) |
void |
setConsumerGroup(String consumerGroup) |
void |
setConsumerPullTimeoutMillis(long consumerPullTimeoutMillis) |
void |
setConsumerTimeoutMillisWhenSuspend(long consumerTimeoutMillisWhenSuspend) |
void |
setMaxReconsumeTimes(int maxReconsumeTimes) |
void |
setMessageModel(MessageModel messageModel) |
void |
setMessageQueueListener(MessageQueueListener messageQueueListener) |
void |
setOffsetStore(OffsetStore offsetStore) |
void |
setRegisterTopics(Set<String> registerTopics) |
void |
setUnitMode(boolean isUnitMode) |
void |
shutdown()
Shutdown the consumer
|
void |
start()
Start the consumer
|
void |
updateConsumeOffset(MessageQueue mq,
long offset)
Update the offset
|
MessageExt |
viewMessage(String offsetMsgId)
Query message according tto message id
|
MessageExt |
viewMessage(String topic,
String uniqKey)
唯一键查询
|
buildMQClientId, changeInstanceNameToPID, cloneClientConfig, getClientCallbackExecutorThreads, getClientIP, getHeartbeatBrokerInterval, getInstanceName, getNamesrvAddr, getPersistConsumerOffsetInterval, getPollNameServerInteval, getUnitName, isVipChannelEnabled, resetClientConfig, setClientCallbackExecutorThreads, setClientIP, setHeartbeatBrokerInterval, setInstanceName, setNamesrvAddr, setPersistConsumerOffsetInterval, setPollNameServerInteval, setUnitName, setVipChannelEnabled, toStringprotected final transient DefaultMQPullConsumerImpl defaultMQPullConsumerImpl
public DefaultMQPullConsumer()
public DefaultMQPullConsumer(String consumerGroup, com.alibaba.rocketmq.remoting.RPCHook rpcHook)
public DefaultMQPullConsumer(String consumerGroup)
public DefaultMQPullConsumer(com.alibaba.rocketmq.remoting.RPCHook rpcHook)
public void createTopic(String key, String newTopic, int queueNum) throws MQClientException
MQAdmincreateTopic 在接口中 MQAdminkey - accesskeynewTopic - topic namequeueNum - topic's queue numberMQClientExceptionpublic void createTopic(String key, String newTopic, int queueNum, int topicSysFlag) throws MQClientException
MQAdmincreateTopic 在接口中 MQAdminkey - accesskeynewTopic - topic namequeueNum - topic's queue numbertopicSysFlag - topic system flagMQClientExceptionpublic long searchOffset(MessageQueue mq, long timestamp) throws MQClientException
MQAdminsearchOffset 在接口中 MQAdminmq - Instance of MessageQueuetimestamp - from when in milliseconds.MQClientExceptionpublic long maxOffset(MessageQueue mq) throws MQClientException
MQAdminmaxOffset 在接口中 MQAdminmq - Instance of MessageQueueMQClientExceptionpublic long minOffset(MessageQueue mq) throws MQClientException
MQAdminminOffset 在接口中 MQAdminmq - Instance of MessageQueueMQClientExceptionpublic long earliestMsgStoreTime(MessageQueue mq) throws MQClientException
MQAdminearliestMsgStoreTime 在接口中 MQAdminmq - Instance of MessageQueueMQClientExceptionpublic MessageExt viewMessage(String offsetMsgId) throws com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException, MQClientException
MQAdminviewMessage 在接口中 MQAdmincom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionMQClientExceptionpublic QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end) throws MQClientException, InterruptedException
MQAdminqueryMessage 在接口中 MQAdmintopic - message topickey - message key index wordmaxNum - max message numberbegin - from whenend - to whenMQClientExceptionInterruptedExceptionpublic AllocateMessageQueueStrategy getAllocateMessageQueueStrategy()
public void setAllocateMessageQueueStrategy(AllocateMessageQueueStrategy allocateMessageQueueStrategy)
public long getBrokerSuspendMaxTimeMillis()
public void setBrokerSuspendMaxTimeMillis(long brokerSuspendMaxTimeMillis)
public String getConsumerGroup()
public void setConsumerGroup(String consumerGroup)
public long getConsumerPullTimeoutMillis()
public void setConsumerPullTimeoutMillis(long consumerPullTimeoutMillis)
public long getConsumerTimeoutMillisWhenSuspend()
public void setConsumerTimeoutMillisWhenSuspend(long consumerTimeoutMillisWhenSuspend)
public MessageModel getMessageModel()
public void setMessageModel(MessageModel messageModel)
public MessageQueueListener getMessageQueueListener()
public void setMessageQueueListener(MessageQueueListener messageQueueListener)
public void sendMessageBack(MessageExt msg, int delayLevel) throws com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException, MQClientException
MQConsumersendMessageBack 在接口中 MQConsumercom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionMQClientExceptionpublic void sendMessageBack(MessageExt msg, int delayLevel, String brokerName) throws com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException, MQClientException
MQConsumersendMessageBack 在接口中 MQConsumercom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionMQClientExceptionpublic Set<MessageQueue> fetchSubscribeMessageQueues(String topic) throws MQClientException
MQConsumerfetchSubscribeMessageQueues 在接口中 MQConsumertopic - message topicMQClientExceptionpublic void start()
throws MQClientException
MQPullConsumerstart 在接口中 MQPullConsumerMQClientExceptionpublic void shutdown()
MQPullConsumershutdown 在接口中 MQPullConsumerpublic void registerMessageQueueListener(String topic, MessageQueueListener listener)
MQPullConsumerregisterMessageQueueListener 在接口中 MQPullConsumerpublic PullResult pull(MessageQueue mq, String subExpression, long offset, int maxNums) throws MQClientException, com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException
MQPullConsumerpull 在接口中 MQPullConsumermq - from which message queuesubExpression - subscription expression.it only support or operation such as "tag1 || tag2 || tag3" offset - from where to pullmaxNums - max pulling numbersMQClientExceptioncom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionpublic PullResult pull(MessageQueue mq, String subExpression, long offset, int maxNums, long timeout) throws MQClientException, com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException
MQPullConsumerpull 在接口中 MQPullConsumerMQClientExceptioncom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionpublic void pull(MessageQueue mq, String subExpression, long offset, int maxNums, PullCallback pullCallback) throws MQClientException, com.alibaba.rocketmq.remoting.exception.RemotingException, InterruptedException
MQPullConsumerpull 在接口中 MQPullConsumerMQClientExceptioncom.alibaba.rocketmq.remoting.exception.RemotingExceptionInterruptedExceptionpublic void pull(MessageQueue mq, String subExpression, long offset, int maxNums, PullCallback pullCallback, long timeout) throws MQClientException, com.alibaba.rocketmq.remoting.exception.RemotingException, InterruptedException
MQPullConsumerpull 在接口中 MQPullConsumerMQClientExceptioncom.alibaba.rocketmq.remoting.exception.RemotingExceptionInterruptedExceptionpublic PullResult pullBlockIfNotFound(MessageQueue mq, String subExpression, long offset, int maxNums) throws MQClientException, com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException
MQPullConsumerpullBlockIfNotFound 在接口中 MQPullConsumerMQClientExceptioncom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionpublic void pullBlockIfNotFound(MessageQueue mq, String subExpression, long offset, int maxNums, PullCallback pullCallback) throws MQClientException, com.alibaba.rocketmq.remoting.exception.RemotingException, InterruptedException
MQPullConsumerpullBlockIfNotFound 在接口中 MQPullConsumerMQClientExceptioncom.alibaba.rocketmq.remoting.exception.RemotingExceptionInterruptedExceptionpublic void updateConsumeOffset(MessageQueue mq, long offset) throws MQClientException
MQPullConsumerupdateConsumeOffset 在接口中 MQPullConsumerMQClientExceptionpublic long fetchConsumeOffset(MessageQueue mq, boolean fromStore) throws MQClientException
MQPullConsumerfetchConsumeOffset 在接口中 MQPullConsumerMQClientExceptionpublic Set<MessageQueue> fetchMessageQueuesInBalance(String topic) throws MQClientException
MQPullConsumerfetchMessageQueuesInBalance 在接口中 MQPullConsumertopic - message topicMQClientExceptionpublic MessageExt viewMessage(String topic, String uniqKey) throws com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException, MQClientException
MQAdminviewMessage 在接口中 MQAdmincom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionMQClientExceptionpublic void sendMessageBack(MessageExt msg, int delayLevel, String brokerName, String consumerGroup) throws com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException, MQClientException
MQPullConsumersendMessageBack 在接口中 MQPullConsumercom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionMQClientExceptionpublic OffsetStore getOffsetStore()
public void setOffsetStore(OffsetStore offsetStore)
public DefaultMQPullConsumerImpl getDefaultMQPullConsumerImpl()
public boolean isUnitMode()
isUnitMode 在类中 ClientConfigpublic void setUnitMode(boolean isUnitMode)
setUnitMode 在类中 ClientConfigpublic int getMaxReconsumeTimes()
public void setMaxReconsumeTimes(int maxReconsumeTimes)
Copyright © 2012–2016. All rights reserved.