Which TransactionSystemClient should I be using?

17 views
Skip to first unread message

Alan Gates

unread,
Mar 17, 2015, 3:13:11 PM3/17/15
to tephr...@googlegroups.com
It looks like there are several implementations of TransactionSystemClient.  The javadoc on DetachedTxSystemClient scared me, as they seemed to imply it was for situations where consistency wasn't crucial.  I don't need ZooKeeper discovery.  Do I still want TransactionServiceClient, or should I be using something else?

Alan.

Gary Helmling

unread,
Mar 17, 2015, 10:19:25 PM3/17/15
to Alan Gates, tephr...@googlegroups.com
Hi Alan,

For normal cluster operations, you would want to use TransactionServiceClient.  This is the regular distributed implementation of TransactionSystemClient.  If you really don't need ZK discovery (it's also used to handle transparent failover between active TransactionService instances), you should be able to pass null for a DiscoveryServiceClient when setting up the client instance:

Configuration conf = new Configuration();
// pass in the transaction service location
conf.set(TxConstants.Service.CFG_DATA_TX_BIND_ADDRESS, "<tx service hostname>");
// if overriding default port
conf.set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, "<port>");
    
ThriftClientProvider clientProvider = new PooledClientProvider(conf, null);
TransactionServiceClient txClient = new TransactionServiceClient(conf, clientProvider);

This bypasses the use of ZK for service discovery and reads the TransactionService address from the provided configuration.

From here you can construct a TransactionContext and use that to control the transaction lifecycle.


Gary







On Tue, Mar 17, 2015 at 12:13 PM, Alan Gates <alanf...@gmail.com> wrote:
It looks like there are several implementations of TransactionSystemClient.  The javadoc on DetachedTxSystemClient scared me, as they seemed to imply it was for situations where consistency wasn't crucial.  I don't need ZooKeeper discovery.  Do I still want TransactionServiceClient, or should I be using something else?

Alan.

--
You received this message because you are subscribed to the Google Groups "Tephra User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tephra-user...@googlegroups.com.
To post to this group, send email to tephr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tephra-user/26c37a0c-48b0-460c-aa63-c33a4f11f9f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages