private void addAQDestinationContext(Context context) throws NamingException {
// lookup and cache the queues
QueueConnectionFactory queueFactory;
QueueConnection queueConnection = null;
TopicConnectionFactory topicFactory;
TopicConnection topicConnection = null;
AQjmsSession session = null;
try {
// create a datasource to use - datasources can keep the
// username/password for later use
DataSource ds = null;
XADataSource xaDs = null;
try {
if (aqConnectionUrl != null)
{
ds = AQUtil.getSQLDataSource(aqConnectionUrl, dbuser, dbpass);
xaDs = AQUtil.getXASQLDataSource(aqConnectionUrl, dbuser, dbpass);
}
else
{
ds = AQUtil.getSQLDataSource( aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser, dbpass);
xaDs = AQUtil.getXASQLDataSource(aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser, dbpass);
}
} catch (SQLException e) {
throw new RuntimeException(e.getMessage());
}
XAConnectionFactory factory = AQjmsFactory.getXAConnectionFactory(xaDs);
context.rebind(XA_CONNECTION_FACTORY, factory);
context.rebind("KURTSTAM", new String("hello"));
// create the connection factory
ConnectionFactory connectionFactory = AQjmsFactory.getConnectionFactory(ds);
context.rebind(CONNECTION_FACTORY, connectionFactory);
// create the queue connection factory
queueFactory = AQjmsFactory.getQueueConnectionFactory(ds);
context.rebind(QUEUE_CONNECTION_FACTORY, queueFactory);
queueConnection = queueFactory.createQueueConnection();
session = (AQjmsSession) queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
// create the queue XA connection factory
XAQueueConnectionFactory xaQueueConnectionFactory = AQjmsFactory.getXAQueueConnectionFactory(xaDs);