public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsumer
| 限定符和类型 | 字段和说明 |
|---|---|
protected DefaultMQPushConsumerImpl |
defaultMQPushConsumerImpl |
SendMessageWithVIPChannelProperty| 构造器和说明 |
|---|
DefaultMQPushConsumer() |
DefaultMQPushConsumer(com.alibaba.rocketmq.remoting.RPCHook rpcHook) |
DefaultMQPushConsumer(String consumerGroup) |
DefaultMQPushConsumer(String consumerGroup,
com.alibaba.rocketmq.remoting.RPCHook rpcHook,
AllocateMessageQueueStrategy allocateMessageQueueStrategy) |
| 限定符和类型 | 方法和说明 |
|---|---|
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
|
Set<MessageQueue> |
fetchSubscribeMessageQueues(String topic)
Fetch message queues from consumer cache according to the topic
|
long |
getAdjustThreadPoolNumsThreshold() |
AllocateMessageQueueStrategy |
getAllocateMessageQueueStrategy() |
int |
getConsumeConcurrentlyMaxSpan() |
ConsumeFromWhere |
getConsumeFromWhere() |
int |
getConsumeMessageBatchMaxSize() |
String |
getConsumerGroup() |
int |
getConsumeThreadMax() |
int |
getConsumeThreadMin() |
long |
getConsumeTimeout() |
String |
getConsumeTimestamp() |
DefaultMQPushConsumerImpl |
getDefaultMQPushConsumerImpl() |
int |
getMaxReconsumeTimes() |
MessageListener |
getMessageListener() |
MessageModel |
getMessageModel() |
OffsetStore |
getOffsetStore() |
int |
getPullBatchSize() |
long |
getPullInterval() |
int |
getPullThresholdForQueue() |
Map<String,String> |
getSubscription() |
long |
getSuspendCurrentQueueTimeMillis() |
boolean |
isPostSubscriptionWhenPull() |
boolean |
isUnitMode() |
long |
maxOffset(MessageQueue mq)
Gets the max offset
|
long |
minOffset(MessageQueue mq)
Gets the minimum offset
|
QueryResult |
queryMessage(String topic,
String key,
int maxNum,
long begin,
long end)
Query messages
|
void |
registerMessageListener(MessageListener messageListener)
已过时。
|
void |
registerMessageListener(MessageListenerConcurrently messageListener) |
void |
registerMessageListener(MessageListenerOrderly messageListener) |
void |
resume()
Resume the consumption
|
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 |
setAdjustThreadPoolNumsThreshold(long adjustThreadPoolNumsThreshold) |
void |
setAllocateMessageQueueStrategy(AllocateMessageQueueStrategy allocateMessageQueueStrategy) |
void |
setConsumeConcurrentlyMaxSpan(int consumeConcurrentlyMaxSpan) |
void |
setConsumeFromWhere(ConsumeFromWhere consumeFromWhere) |
void |
setConsumeMessageBatchMaxSize(int consumeMessageBatchMaxSize) |
void |
setConsumerGroup(String consumerGroup) |
void |
setConsumeThreadMax(int consumeThreadMax) |
void |
setConsumeThreadMin(int consumeThreadMin) |
void |
setConsumeTimeout(long consumeTimeout) |
void |
setConsumeTimestamp(String consumeTimestamp) |
void |
setMaxReconsumeTimes(int maxReconsumeTimes) |
void |
setMessageListener(MessageListener messageListener) |
void |
setMessageModel(MessageModel messageModel) |
void |
setOffsetStore(OffsetStore offsetStore) |
void |
setPostSubscriptionWhenPull(boolean postSubscriptionWhenPull) |
void |
setPullBatchSize(int pullBatchSize) |
void |
setPullInterval(long pullInterval) |
void |
setPullThresholdForQueue(int pullThresholdForQueue) |
void |
setSubscription(Map<String,String> subscription) |
void |
setSuspendCurrentQueueTimeMillis(long suspendCurrentQueueTimeMillis) |
void |
setUnitMode(boolean isUnitMode) |
void |
shutdown()
Shutdown the consumer
|
void |
start()
Start the consumer
|
void |
subscribe(String topic,
String subExpression)
Subscribe some topic
|
void |
subscribe(String topic,
String fullClassName,
String filterClassSource)
Subscribe some topic
|
void |
suspend()
Suspend the consumption
|
void |
unsubscribe(String topic)
Unsubscribe consumption some topic
|
void |
updateCorePoolSize(int corePoolSize)
Update the consumer thread pool size Dynamically
|
MessageExt |
viewMessage(String offsetMsgId)
Query message according tto message id
|
MessageExt |
viewMessage(String topic,
String msgId) |
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 DefaultMQPushConsumerImpl defaultMQPushConsumerImpl
public DefaultMQPushConsumer()
public DefaultMQPushConsumer(String consumerGroup, com.alibaba.rocketmq.remoting.RPCHook rpcHook, AllocateMessageQueueStrategy allocateMessageQueueStrategy)
public DefaultMQPushConsumer(com.alibaba.rocketmq.remoting.RPCHook rpcHook)
public DefaultMQPushConsumer(String consumerGroup)
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 在接口中 MQAdminoffsetMsgId - message idcom.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 MessageExt viewMessage(String topic, String msgId) throws com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException, MQClientException
viewMessage 在接口中 MQAdmincom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQBrokerExceptionInterruptedExceptionMQClientExceptionpublic AllocateMessageQueueStrategy getAllocateMessageQueueStrategy()
public void setAllocateMessageQueueStrategy(AllocateMessageQueueStrategy allocateMessageQueueStrategy)
public int getConsumeConcurrentlyMaxSpan()
public void setConsumeConcurrentlyMaxSpan(int consumeConcurrentlyMaxSpan)
public ConsumeFromWhere getConsumeFromWhere()
public void setConsumeFromWhere(ConsumeFromWhere consumeFromWhere)
public int getConsumeMessageBatchMaxSize()
public void setConsumeMessageBatchMaxSize(int consumeMessageBatchMaxSize)
public String getConsumerGroup()
public void setConsumerGroup(String consumerGroup)
public int getConsumeThreadMax()
public void setConsumeThreadMax(int consumeThreadMax)
public int getConsumeThreadMin()
public void setConsumeThreadMin(int consumeThreadMin)
public DefaultMQPushConsumerImpl getDefaultMQPushConsumerImpl()
public MessageListener getMessageListener()
public void setMessageListener(MessageListener messageListener)
public MessageModel getMessageModel()
public void setMessageModel(MessageModel messageModel)
public int getPullBatchSize()
public void setPullBatchSize(int pullBatchSize)
public long getPullInterval()
public void setPullInterval(long pullInterval)
public int getPullThresholdForQueue()
public void setPullThresholdForQueue(int pullThresholdForQueue)
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
MQPushConsumerstart 在接口中 MQPushConsumerMQClientExceptionpublic void shutdown()
MQPushConsumershutdown 在接口中 MQPushConsumer@Deprecated public void registerMessageListener(MessageListener messageListener)
MQPushConsumerregisterMessageListener 在接口中 MQPushConsumerpublic void registerMessageListener(MessageListenerConcurrently messageListener)
registerMessageListener 在接口中 MQPushConsumerpublic void registerMessageListener(MessageListenerOrderly messageListener)
registerMessageListener 在接口中 MQPushConsumerpublic void subscribe(String topic, String subExpression) throws MQClientException
MQPushConsumersubscribe 在接口中 MQPushConsumersubExpression - subscription expression.it only support or operation such as
"tag1 || tag2 || tag3" MQClientExceptionpublic void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException
MQPushConsumersubscribe 在接口中 MQPushConsumerfullClassName - full class name,must extend
com.alibaba.rocketmq.common.filter. MessageFilterfilterClassSource - class source code,used UTF-8 file encoding,must be responsible
for your code safetyMQClientExceptionpublic void unsubscribe(String topic)
MQPushConsumerunsubscribe 在接口中 MQPushConsumertopic - message topicpublic void updateCorePoolSize(int corePoolSize)
MQPushConsumerupdateCorePoolSize 在接口中 MQPushConsumerpublic void suspend()
MQPushConsumersuspend 在接口中 MQPushConsumerpublic void resume()
MQPushConsumerresume 在接口中 MQPushConsumerpublic OffsetStore getOffsetStore()
public void setOffsetStore(OffsetStore offsetStore)
public String getConsumeTimestamp()
public void setConsumeTimestamp(String consumeTimestamp)
public boolean isPostSubscriptionWhenPull()
public void setPostSubscriptionWhenPull(boolean postSubscriptionWhenPull)
public boolean isUnitMode()
isUnitMode 在类中 ClientConfigpublic void setUnitMode(boolean isUnitMode)
setUnitMode 在类中 ClientConfigpublic long getAdjustThreadPoolNumsThreshold()
public void setAdjustThreadPoolNumsThreshold(long adjustThreadPoolNumsThreshold)
public int getMaxReconsumeTimes()
public void setMaxReconsumeTimes(int maxReconsumeTimes)
public long getSuspendCurrentQueueTimeMillis()
public void setSuspendCurrentQueueTimeMillis(long suspendCurrentQueueTimeMillis)
public long getConsumeTimeout()
public void setConsumeTimeout(long consumeTimeout)
Copyright © 2012–2016. All rights reserved.