*/
protected TopicConnection setupTopicConnection(Context ctx, String user, String pass, String clientID) throws Exception
{
String topicFactoryRef = adapter.getTopicFactoryRef();
log.debug("Attempting to lookup topic connection factory " + topicFactoryRef);
TopicConnectionFactory tcf = (TopicConnectionFactory) Util.lookup(ctx, topicFactoryRef, TopicConnectionFactory.class);
log.debug("Got topic connection factory " + tcf + " from " + topicFactoryRef);
log.debug("Attempting to create topic connection with user " + user);
TopicConnection result;
if (tcf instanceof XATopicConnectionFactory && isDeliveryTransacted)
{
XATopicConnectionFactory xatcf = (XATopicConnectionFactory) tcf;
if (user != null)
result = xatcf.createXATopicConnection(user, pass);
else
result = xatcf.createXATopicConnection();
}
else
{
if (user != null)
result = tcf.createTopicConnection(user, pass);
else
result = tcf.createTopicConnection();
}
try
{
if (clientID != null)
result.setClientID(clientID);