Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Transaction Semantics | Using Broker Transaction Clients | Creating a Transactional Client
 
Creating a Transactional Client
To work purely in a transactional environment interacting with transactional methods, only the BrokerTransactionalClient object is required. The following example shows how to create a BrokerTransactionalClient object. Note that the following example also applies to reconnectTransactionalClient() method.
public void connect()
{
BrokerTransactionalClient pub, sub;
 
/* Create publisher */
try {
pub = BrokerTransactionalClient.newOrReconnectTransactionalClient
(broker_host, broker_name,pubid, client_group_p, "TxTest-Pub",
null);
} catch (BrokerException ex) {
System.out.println ("Failed to create pub client\n" + ex);
System.exit(1);
}
 
/* Create subscriber */
try {
sub = BrokerTransactionalClient.newOrReconnectTransactionalClient
(broker_host, broker_name, subid, client_group_s, "TxTest-Sub",
null);
 
} catch (BrokerException ex) {
System.out.println ("Failed to create pub client\n" + ex);
System.exit(1);
}