com.taobao.metamorphosis.client.producer
类 SimpleXAMessageProducer

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

public class SimpleXAMessageProducer
extends SimpleMessageProducer
implements XAMessageProducer, ProducerZooKeeper.BrokerChangeListener

XA消息生产者的实现类

作者:
boyan

字段摘要
 
从类 com.taobao.metamorphosis.client.producer.SimpleMessageProducer 继承的字段
DEFAULT_OP_TIMEOUT, lastSentInfo, partitionSelector, producerZooKeeper, remotingClient, sessionId, transactionContext, transactionRequestTimeoutInMills, transactionTimeout
 
从接口 com.taobao.metamorphosis.client.producer.XAMessageProducer 继承的字段
DEFAULT_UNIQUE_QUALIFIER_PREFIX
 
构造方法摘要
SimpleXAMessageProducer(MetaMessageSessionFactory messageSessionFactory, RemotingClientWrapper remotingClient, PartitionSelector partitionSelector, ProducerZooKeeper producerZooKeeper, String sessionId)
           
 
方法摘要
 void brokersChanged(String topic)
          called when broker list changed.
static String getLocalhostName()
           
 String getUniqueQualifier()
          Returns the unique qualifier for this XA producer.The default is "XAMessageProducer-[hostname]".
 XAResource getXAResource()
          返回一个XAResource对象。
 void publish(String topic)
          发布topic,以便producer从zookeeper获取broker列表并连接,在发送消息前必须先调用此方法
 void setUniqueQualifier(String uniqueQualifier)
          Set the unique qualifier for this producer,it must be unique in global and is not changed after be set.
 void setUniqueQualifierPrefix(String prefix)
          Set unique qualifier prefix for this message producer,Then the unique qualifier will be "[prefix]-[hostname]".The default prefix is "XAMessageProducer",but recommend you to set an unique qualifier prefix for this producer,such as your application name.
 void shutdown()
          关闭生产者,释放资源
 
从类 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, sendMessage, sendMessageToServer, setDefaultTopic, setTransactionRequestTimeout, setTransactionTimeout
 
从类 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, rollback, sendMessage, sendMessage, sendMessage, sendMessage, setDefaultTopic, setTransactionRequestTimeout, setTransactionTimeout
 

构造方法详细信息

SimpleXAMessageProducer

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

getLocalhostName

public static String getLocalhostName()

publish

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

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

brokersChanged

public void brokersChanged(String topic)
从接口 ProducerZooKeeper.BrokerChangeListener 复制的描述
called when broker list changed.

指定者:
接口 ProducerZooKeeper.BrokerChangeListener 中的 brokersChanged

getUniqueQualifier

public String getUniqueQualifier()
从接口 XAMessageProducer 复制的描述
Returns the unique qualifier for this XA producer.The default is "XAMessageProducer-[hostname]".

指定者:
接口 XAMessageProducer 中的 getUniqueQualifier
返回:

setUniqueQualifier

public void setUniqueQualifier(String uniqueQualifier)
从接口 XAMessageProducer 复制的描述
Set the unique qualifier for this producer,it must be unique in global and is not changed after be set.

指定者:
接口 XAMessageProducer 中的 setUniqueQualifier

setUniqueQualifierPrefix

public void setUniqueQualifierPrefix(String prefix)
从接口 XAMessageProducer 复制的描述
Set unique qualifier prefix for this message producer,Then the unique qualifier will be "[prefix]-[hostname]".The default prefix is "XAMessageProducer",but recommend you to set an unique qualifier prefix for this producer,such as your application name.

指定者:
接口 XAMessageProducer 中的 setUniqueQualifierPrefix
参数:
prefix - Prefix string for unique qualifier,it will be added in front of hostname.

getXAResource

public XAResource getXAResource()
                         throws MetaClientException
从接口 XAMessageProducer 复制的描述
返回一个XAResource对象。事务管理器将使用该对象来管理XAMessageProducer参与到一个分布式事务中。

指定者:
接口 XAMessageProducer 中的 getXAResource
返回:
抛出:
MetaClientException

shutdown

public void shutdown()
              throws MetaClientException
从接口 MessageProducer 复制的描述
关闭生产者,释放资源

指定者:
接口 MessageProducer 中的 shutdown
指定者:
接口 Shutdownable 中的 shutdown
覆盖:
SimpleMessageProducer 中的 shutdown
抛出:
MetaClientException


Copyright © 2010–2013. All rights reserved.