|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.alibaba.rocketmq.client.ClientConfig
com.alibaba.rocketmq.client.producer.DefaultMQProducer
public class DefaultMQProducer
消息生产者,适合使用spring初始化
| 字段摘要 | |
|---|---|
protected DefaultMQProducerImpl |
defaultMQProducerImpl
|
| 构造方法摘要 | |
|---|---|
DefaultMQProducer()
|
|
DefaultMQProducer(String producerGroup)
|
|
| 方法摘要 | |
|---|---|
void |
createTopic(String key,
String newTopic,
int queueNum)
创建topic |
long |
earliestMsgStoreTime(MessageQueue mq)
向服务器查询队列保存的最早消息对应的存储时间 |
List<MessageQueue> |
fetchPublishMessageQueues(String topic)
根据topic获取对应的MessageQueue,如果是顺序消息,则按照顺序消息配置返回 |
int |
getCompressMsgBodyOverHowmuch()
|
String |
getCreateTopicKey()
|
DefaultMQProducerImpl |
getDefaultMQProducerImpl()
|
int |
getDefaultTopicQueueNums()
|
int |
getMaxMessageSize()
|
String |
getProducerGroup()
|
int |
getRetryTimesWhenSendFailed()
|
int |
getSendMsgTimeout()
|
boolean |
isRetryAnotherBrokerWhenNotStoreOK()
|
boolean |
isUnitMode()
|
long |
maxOffset(MessageQueue mq)
向服务器查询队列最大Offset PS: 最大Offset无对应消息,减1有消息 |
long |
minOffset(MessageQueue mq)
向服务器查询队列最小Offset PS: 最小Offset有对应消息 |
QueryResult |
queryMessage(String topic,
String key,
int maxNum,
long begin,
long end)
根据消息Key查询消息 |
long |
searchOffset(MessageQueue mq,
long timestamp)
根据时间查询对应的offset,精确到毫秒 P.S. |
SendResult |
send(Message msg)
发送消息,同步调用 |
SendResult |
send(Message msg,
MessageQueue mq)
向指定队列发送消息,同步调用 |
SendResult |
send(Message msg,
MessageQueueSelector selector,
Object arg)
发送消息,可以自定义选择队列,队列的总数可能会由于Broker的启停变化 如果要保证消息严格有序,在向运维人员申请Topic时,需要特别说明 同步调用 |
void |
send(Message msg,
MessageQueueSelector selector,
Object arg,
SendCallback sendCallback)
发送消息,可以自定义选择队列,队列的总数可能会由于Broker的启停变化 如果要保证消息严格有序,在向运维人员申请Topic时,需要特别说明 异步调用 |
void |
send(Message msg,
MessageQueue mq,
SendCallback sendCallback)
向指定队列发送消息,异步调用 |
void |
send(Message msg,
SendCallback sendCallback)
发送消息,异步调用 |
TransactionSendResult |
sendMessageInTransaction(Message msg,
LocalTransactionExecuter tranExecuter,
Object arg)
|
void |
sendOneway(Message msg)
发送消息,Oneway形式,服务器不应答,无法保证消息是否成功到达服务器 |
void |
sendOneway(Message msg,
MessageQueue mq)
向指定队列发送消息,Oneway形式,服务器不应答,无法保证消息是否成功到达服务器 |
void |
sendOneway(Message msg,
MessageQueueSelector selector,
Object arg)
发送消息,可以自定义选择队列,队列的总数可能会由于Broker的启停变化 如果要保证消息严格有序,在向运维人员申请Topic时,需要特别说明 Oneway形式,服务器不应答,无法保证消息是否成功到达服务器 |
void |
setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch)
|
void |
setCreateTopicKey(String createTopicKey)
|
void |
setDefaultTopicQueueNums(int defaultTopicQueueNums)
|
void |
setMaxMessageSize(int maxMessageSize)
|
void |
setProducerGroup(String producerGroup)
|
void |
setRetryAnotherBrokerWhenNotStoreOK(boolean retryAnotherBrokerWhenNotStoreOK)
|
void |
setRetryTimesWhenSendFailed(int retryTimesWhenSendFailed)
|
void |
setSendMsgTimeout(int sendMsgTimeout)
|
void |
setUnitMode(boolean isUnitMode)
|
void |
shutdown()
关闭服务,一旦关闭,此对象将不可用 |
void |
start()
启动服务 |
MessageExt |
viewMessage(String msgId)
根据消息ID,从服务器获取完整的消息 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
protected final transient DefaultMQProducerImpl defaultMQProducerImpl
| 构造方法详细信息 |
|---|
public DefaultMQProducer()
public DefaultMQProducer(String producerGroup)
| 方法详细信息 |
|---|
public void start()
throws MQClientException
MQProducer 复制的描述
MQProducer 中的 startMQClientExceptionpublic void shutdown()
MQProducer 复制的描述
MQProducer 中的 shutdown
public List<MessageQueue> fetchPublishMessageQueues(String topic)
throws MQClientException
MQProducer 复制的描述
MQProducer 中的 fetchPublishMessageQueuestopic - 消息Topic
MQClientException
public SendResult send(Message msg)
throws MQClientException,
RemotingException,
MQBrokerException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendmsg - 消息
MQClientException
RemotingException
MQBrokerException
InterruptedException
public void send(Message msg,
SendCallback sendCallback)
throws MQClientException,
RemotingException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendmsg - 消息sendCallback - 发送结果通过此接口回调
MQClientException
RemotingException
InterruptedException
public void sendOneway(Message msg)
throws MQClientException,
RemotingException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendOnewaymsg - 消息
MQClientException
RemotingException
InterruptedException
public SendResult send(Message msg,
MessageQueue mq)
throws MQClientException,
RemotingException,
MQBrokerException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendmsg - 消息mq - 队列
MQClientException
RemotingException
MQBrokerException
InterruptedException
public void send(Message msg,
MessageQueue mq,
SendCallback sendCallback)
throws MQClientException,
RemotingException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendmsg - 消息mq - 队列sendCallback - 发送结果通过此接口回调
MQClientException
RemotingException
InterruptedException
public void sendOneway(Message msg,
MessageQueue mq)
throws MQClientException,
RemotingException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendOnewaymsg - 消息mq - 队列
MQClientException
RemotingException
InterruptedException
public SendResult send(Message msg,
MessageQueueSelector selector,
Object arg)
throws MQClientException,
RemotingException,
MQBrokerException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendmsg - 消息selector - 队列选择器,发送时会回调arg - 回调队列选择器时,此参数会传入队列选择方法
MQClientException
RemotingException
MQBrokerException
InterruptedException
public void send(Message msg,
MessageQueueSelector selector,
Object arg,
SendCallback sendCallback)
throws MQClientException,
RemotingException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendmsg - 消息selector - 队列选择器,发送时会回调arg - 回调队列选择器时,此参数会传入队列选择方法sendCallback - 发送结果通过此接口回调
MQClientException
RemotingException
InterruptedException
public void sendOneway(Message msg,
MessageQueueSelector selector,
Object arg)
throws MQClientException,
RemotingException,
InterruptedException
MQProducer 复制的描述
MQProducer 中的 sendOnewaymsg - 消息selector - 队列选择器,发送时会回调arg - 回调队列选择器时,此参数会传入队列选择方法
MQClientException
RemotingException
InterruptedException
public TransactionSendResult sendMessageInTransaction(Message msg,
LocalTransactionExecuter tranExecuter,
Object arg)
throws MQClientException
MQProducer 中的 sendMessageInTransactionMQClientException
public void createTopic(String key,
String newTopic,
int queueNum)
throws MQClientException
MQAdmin 复制的描述
MQAdmin 中的 createTopickey - 请向运维人员申请newTopic - 要创建的新topicqueueNum - 新topic队列数
MQClientException
public long searchOffset(MessageQueue mq,
long timestamp)
throws MQClientException
MQAdmin 复制的描述
MQAdmin 中的 searchOffsetmq - 队列timestamp - 毫秒形式时间戳
MQClientException
public long maxOffset(MessageQueue mq)
throws MQClientException
MQAdmin 复制的描述
MQAdmin 中的 maxOffsetmq - 队列
MQClientException
public long minOffset(MessageQueue mq)
throws MQClientException
MQAdmin 复制的描述
MQAdmin 中的 minOffsetmq - 队列
MQClientException
public long earliestMsgStoreTime(MessageQueue mq)
throws MQClientException
MQAdmin 复制的描述
MQAdmin 中的 earliestMsgStoreTimemq - 队列
MQClientException
public MessageExt viewMessage(String msgId)
throws RemotingException,
MQBrokerException,
InterruptedException,
MQClientException
MQAdmin 复制的描述
MQAdmin 中的 viewMessageRemotingException
MQBrokerException
InterruptedException
MQClientException
public QueryResult queryMessage(String topic,
String key,
int maxNum,
long begin,
long end)
throws MQClientException,
InterruptedException
MQAdmin 复制的描述
MQAdmin 中的 queryMessagetopic - 消息主题key - 消息关键词maxNum - 查询最大条数begin - 起始时间戳end - 结束时间戳
MQClientException
InterruptedExceptionpublic String getProducerGroup()
public void setProducerGroup(String producerGroup)
public String getCreateTopicKey()
public void setCreateTopicKey(String createTopicKey)
public int getSendMsgTimeout()
public void setSendMsgTimeout(int sendMsgTimeout)
public int getCompressMsgBodyOverHowmuch()
public void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch)
public DefaultMQProducerImpl getDefaultMQProducerImpl()
public boolean isRetryAnotherBrokerWhenNotStoreOK()
public void setRetryAnotherBrokerWhenNotStoreOK(boolean retryAnotherBrokerWhenNotStoreOK)
public int getMaxMessageSize()
public void setMaxMessageSize(int maxMessageSize)
public int getDefaultTopicQueueNums()
public void setDefaultTopicQueueNums(int defaultTopicQueueNums)
public int getRetryTimesWhenSendFailed()
public void setRetryTimesWhenSendFailed(int retryTimesWhenSendFailed)
public boolean isUnitMode()
public void setUnitMode(boolean isUnitMode)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||