Debug.print( "sendToJMSQueue(" + queueName + "," + obj + "," + transacted + ")" );
InitialContext ic = null;
QueueConnection cnn = null;
QueueSender sender = null;
QueueSession session = null;
try
{
ic = new InitialContext( );
Queue queue = ( Queue ) ic.lookup( queueName );
QueueConnectionFactory factory = ( QueueConnectionFactory ) ic.lookup( JNDINames.QUEUE_CONNECTION_FACTORY );
cnn = factory.createQueueConnection( );
session = cnn.createQueueSession( transacted, QueueSession.AUTO_ACKNOWLEDGE );
ObjectMessage msg = session.createObjectMessage( obj );
sender = session.createSender( queue );
sender.send( msg );
}
finally
{
if ( sender != null )
{
sender.close( );
}
if ( session != null )
{
session.close( );
}
if ( cnn != null )
{
cnn.close( );
}
if ( ic != null )
{
ic.close( );
}
}