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

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

public class OrderedMessageProducer
extends SimpleMessageProducer

 有序消息生产者的实现类,需要按照消息内容(例如某个id)散列到固定分区并要求有序的场景中使用.
 当预期的分区不可用时,消息将缓存到本地,分区可用时恢复.
 

从以下版本开始:
2011-8-24 下午4:37:48
作者:
无花

字段摘要
 
从类 com.taobao.metamorphosis.client.producer.SimpleMessageProducer 继承的字段
DEFAULT_OP_TIMEOUT, lastSentInfo, partitionSelector, producerZooKeeper, remotingClient, sessionId, transactionContext, transactionRequestTimeoutInMills, transactionTimeout
 
构造方法摘要
OrderedMessageProducer(MetaMessageSessionFactory messageSessionFactory, RemotingClientWrapper remotingClient, PartitionSelector partitionSelector, ProducerZooKeeper producerZooKeeper, String sessionId, MessageRecoverManager localMessageStorageManager)
           
 
方法摘要
 void publish(String topic)
          发布topic,以便producer从zookeeper获取broker列表并连接,在发送消息前必须先调用此方法
 SendResult sendMessage(Message message, long timeout, TimeUnit unit)
          发送消息,如果超出指定的时间内没有返回,则抛出异常
 
从类 com.taobao.metamorphosis.client.producer.SimpleMessageProducer 继承的方法
beforeSendMessageFirstTime, beginTransaction, checkMessage, checkState, commit, getParent, getPartitionSelector, getSessionId, getTransactionId, getTransactionTimeout, invokeToGroup, isInTransaction, isOrdered, logLastSentInfo, removeContext, resetLastSentInfo, rollback, sendMessage, sendMessage, sendMessage, sendMessageToServer, setDefaultTopic, setTransactionRequestTimeout, setTransactionTimeout, shutdown
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

OrderedMessageProducer

public OrderedMessageProducer(MetaMessageSessionFactory messageSessionFactory,
                              RemotingClientWrapper remotingClient,
                              PartitionSelector partitionSelector,
                              ProducerZooKeeper producerZooKeeper,
                              String sessionId,
                              MessageRecoverManager localMessageStorageManager)
方法详细信息

publish

public void publish(String topic)
从接口 MessageProducer 复制的描述
发布topic,以便producer从zookeeper获取broker列表并连接,在发送消息前必须先调用此方法

指定者:
接口 MessageProducer 中的 publish
覆盖:
SimpleMessageProducer 中的 publish

sendMessage

public SendResult sendMessage(Message message,
                              long timeout,
                              TimeUnit unit)
                       throws MetaClientException,
                              InterruptedException
从接口 MessageProducer 复制的描述
发送消息,如果超出指定的时间内没有返回,则抛出异常

指定者:
接口 MessageProducer 中的 sendMessage
覆盖:
SimpleMessageProducer 中的 sendMessage
参数:
message - 消息对象
timeout - 超时时间
unit - 超时的时间单位
返回:
发送结果
抛出:
MetaClientException - 客户端异常
InterruptedException - 响应中断


Copyright © 2010–2013. All rights reserved.