com.taobao.metamorphosis.client.extension.producer
类 AsyncMetaMessageProducer

java.lang.Object
  继承者 com.taobao.metamorphosis.client.producer.SimpleMessageProducer
      继承者 com.taobao.metamorphosis.client.extension.producer.AsyncMetaMessageProducer
所有已实现的接口:
AsyncMessageProducer, MessageRecoverManager.MessageRecoverer, MessageProducer, Shutdownable, TransactionSession

public class AsyncMetaMessageProducer
extends SimpleMessageProducer
implements AsyncMessageProducer, MessageRecoverManager.MessageRecoverer

 异步单向发送消息给服务器的生产者实现.
 
 使用场景:
      对于发送可靠性要求不那么高,但要求提高发送效率和降低对宿主应用的影响,提高宿主应用的稳定性.
      例如,收集日志或用户行为信息等场景.
 注意:
      发送消息后返回的结果中不包含准确的messageId和offset,这些值都是-1

从以下版本开始:
2011-10-21 下午1:42:55
作者:
无花

嵌套类摘要
static class AsyncMetaMessageProducer.MetaMessageOverflowException
          表示消息流量过载的异常
 
从接口 com.taobao.metamorphosis.client.extension.producer.AsyncMessageProducer 继承的嵌套类/接口
AsyncMessageProducer.IgnoreMessageProcessor
 
字段摘要
 
从类 com.taobao.metamorphosis.client.producer.SimpleMessageProducer 继承的字段
DEFAULT_OP_TIMEOUT, lastSentInfo, partitionSelector, producerZooKeeper, remotingClient, sessionId, transactionContext, transactionRequestTimeoutInMills, transactionTimeout
 
构造方法摘要
AsyncMetaMessageProducer(MetaMessageSessionFactory messageSessionFactory, RemotingClientWrapper remotingClient, PartitionSelector partitionSelector, ProducerZooKeeper producerZooKeeper, String sessionId, int slidingWindowSize0, AsyncMessageProducer.IgnoreMessageProcessor processor)
           
 
方法摘要
 void asyncSendMessage(Message message)
           异步发送消息.
 void asyncSendMessage(Message message, long timeout, TimeUnit unit)
           异步发送消息.
 void handle(Message msg)
          recover出来的消息如何处理
protected  BooleanCommand invokeToGroup(String serverUrl, Partition partition, PutCommand putCommand, Message message, long timeout, TimeUnit unit)
           
 void setIgnoreMessageProcessor(AsyncMessageProducer.IgnoreMessageProcessor ignoreMessageProcessor)
          设置发送失败和超过流控消息的处理器,用户可以自己接管这些消息如何处理
 
从类 com.taobao.metamorphosis.client.producer.SimpleMessageProducer 继承的方法
beforeSendMessageFirstTime, beginTransaction, checkMessage, checkState, commit, getParent, getPartitionSelector, getSessionId, getTransactionId, getTransactionTimeout, isInTransaction, isOrdered, logLastSentInfo, publish, removeContext, resetLastSentInfo, rollback, sendMessage, sendMessage, sendMessage, sendMessage, sendMessageToServer, setDefaultTopic, setTransactionRequestTimeout, setTransactionTimeout, shutdown
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 com.taobao.metamorphosis.client.producer.MessageProducer 继承的方法
beginTransaction, commit, getPartitionSelector, getTransactionTimeout, isOrdered, publish, rollback, sendMessage, sendMessage, sendMessage, sendMessage, setDefaultTopic, setTransactionRequestTimeout, setTransactionTimeout, shutdown
 

构造方法详细信息

AsyncMetaMessageProducer

public AsyncMetaMessageProducer(MetaMessageSessionFactory messageSessionFactory,
                                RemotingClientWrapper remotingClient,
                                PartitionSelector partitionSelector,
                                ProducerZooKeeper producerZooKeeper,
                                String sessionId,
                                int slidingWindowSize0,
                                AsyncMessageProducer.IgnoreMessageProcessor processor)
方法详细信息

asyncSendMessage

public void asyncSendMessage(Message message)
从接口 AsyncMessageProducer 复制的描述
 异步发送消息.
 最大限度的减少对业务主流程的影响,使用者不关心发送成功或失败和所有异常

指定者:
接口 AsyncMessageProducer 中的 asyncSendMessage
参数:
message -

asyncSendMessage

public void asyncSendMessage(Message message,
                             long timeout,
                             TimeUnit unit)
从接口 AsyncMessageProducer 复制的描述
 异步发送消息. 
 最大限度的减少对业务主流程的影响,使用者不关心发送成功或失败和所有异常

指定者:
接口 AsyncMessageProducer 中的 asyncSendMessage
unit -

setIgnoreMessageProcessor

public void setIgnoreMessageProcessor(AsyncMessageProducer.IgnoreMessageProcessor ignoreMessageProcessor)
从接口 AsyncMessageProducer 复制的描述
设置发送失败和超过流控消息的处理器,用户可以自己接管这些消息如何处理

指定者:
接口 AsyncMessageProducer 中的 setIgnoreMessageProcessor

invokeToGroup

protected BooleanCommand invokeToGroup(String serverUrl,
                                       Partition partition,
                                       PutCommand putCommand,
                                       Message message,
                                       long timeout,
                                       TimeUnit unit)
                                throws InterruptedException,
                                       TimeoutException,
                                       com.taobao.gecko.service.exception.NotifyRemotingException
覆盖:
SimpleMessageProducer 中的 invokeToGroup
抛出:
InterruptedException
TimeoutException
com.taobao.gecko.service.exception.NotifyRemotingException

handle

public void handle(Message msg)
            throws Exception
从接口 MessageRecoverManager.MessageRecoverer 复制的描述
recover出来的消息如何处理

指定者:
接口 MessageRecoverManager.MessageRecoverer 中的 handle
抛出:
Exception


Copyright © 2010–2013. All rights reserved.