Package javax.jms

Examples of javax.jms.QueueConnectionFactory


      // Get the initial context
      Context jndicontext = getInitialContext();

      // Get the connection factory
      QueueConnectionFactory queueFactory =
   (QueueConnectionFactory)jndicontext.lookup("ConnectionFactory");

      // Create the connection
      queueConnection = queueFactory.createQueueConnection();

      // Create the session with: No transaction and Auto ack
      queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      // Look up the destination
View Full Code Here


      // Get the initial context
      Context jndicontext = getInitialContext();

      // Get the connection factory
      QueueConnectionFactory queueFactory =
    (QueueConnectionFactory)jndicontext.lookup("ConnectionFactory");

      // Create the connection
      queueConnection = queueFactory.createQueueConnection();

      // Create the session with: No Transaction and Auto ack
      queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);

      // Look up the destination
View Full Code Here

    int serverPort =
      ((ManagedConnectionFactoryImpl) mcf).getServerPort().intValue();
   
    try {
      if (cxRequest instanceof QueueConnectionRequest) {
        QueueConnectionFactory factory = QueueTcpConnectionFactory.create(hostName, serverPort);
        setFactoryParameters((AbstractConnectionFactory) factory, (ManagedConnectionFactoryImpl) mcf);
        ((AbstractConnectionFactory) factory).setIdentityClassName(identityClass);
        return factory.createQueueConnection(userName, password);
      } else if (cxRequest instanceof TopicConnectionRequest) {
        TopicConnectionFactory factory = TopicTcpConnectionFactory.create(hostName, serverPort);
        setFactoryParameters((AbstractConnectionFactory) factory, (ManagedConnectionFactoryImpl) mcf);
        ((AbstractConnectionFactory) factory).setIdentityClassName(identityClass);
        return factory.createTopicConnection(userName, password);
      } else {
        ConnectionFactory factory = TcpConnectionFactory.create(hostName, serverPort);
        setFactoryParameters((AbstractConnectionFactory) factory, (ManagedConnectionFactoryImpl) mcf);
        ((AbstractConnectionFactory) factory).setIdentityClassName(identityClass);
        return factory.createConnection(userName, password);
      }
    } catch (IllegalStateException exc) {
      throw new CommException("Could not access the JORAM server: " + exc);
    } catch (JMSSecurityException exc) {
      throw new SecurityException("Invalid user identification: " + exc);
View Full Code Here

      env.put("java.naming.factory.host", "localhost");
      env.put("java.naming.factory.port", "16400");
      ictx = new InitialContext(env);
     
      Queue queue = (Queue) ictx.lookup("queue");
      QueueConnectionFactory qcf = (QueueConnectionFactory) ictx.lookup("qcf");
      ictx.close();

      QueueConnection qc = qcf.createQueueConnection();
      QueueSession qs = qc.createQueueSession(true, 0);
      QueueSender qsend = qs.createSender(queue);
      TextMessage msg = qs.createTextMessage();

      qc.start();
View Full Code Here

        {
            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 );
View Full Code Here

      }
      Context ctx = this.context;
      if (ctx == null) {
        ctx = new InitialContext();
      }
      QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup(connFactoryName);
      this.connection = factory.createQueueConnection();
      this.session = this.connection.createQueueSession(transactedQueue, acknowledgeMode);
      this.queue = this.session.createQueue(queueName);
      this.responseQueue = this.session.createQueue(responseQueueName);
      this.producer = this.session.createProducer(this.queue);
      this.connection.start();
View Full Code Here

    if ("AUTO_ACKNOWLEDGE".equals(ackModeString)) {
      ackMode = Session.AUTO_ACKNOWLEDGE;
    } else if ("CLIENT_ACKNOWLEDGE".equals(ackModeString)) {
      ackMode = Session.CLIENT_ACKNOWLEDGE;
    }
    QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup(connFactoryName);
    try {
      this.connection = factory.createQueueConnection();
      this.session = connection.createQueueSession(transacted, ackMode);
      this.queue = this.session.createQueue(queueName);
      this.responseQueue = this.session.createQueue(responseQueueName);
      this.consumer = this.session.createReceiver(this.queue);
      this.connection.start();
View Full Code Here

        //
        Context context = JMSUtils.getInitialContext(addrDetails);
        Connection connection = null;
       
        if (JMSConstants.JMS_QUEUE.equals(addrDetails.getDestinationStyle().value())) {
            QueueConnectionFactory qcf =
                (QueueConnectionFactory)context.lookup(addrDetails.getJndiConnectionFactoryName());
            if (addrDetails.isSetConnectionUserName()) {
                connection = qcf.createQueueConnection(addrDetails.getConnectionUserName(),
                                                       addrDetails.getConnectionPassword());
            } else {
                connection = qcf.createQueueConnection();
            }
        } else {
            TopicConnectionFactory tcf =
                (TopicConnectionFactory)context.lookup(addrDetails.getJndiConnectionFactoryName());
            if (addrDetails.isSetConnectionUserName()) {
View Full Code Here

    * Test that ConnectionFactory can be cast to QueueConnectionFactory and QueueConnection can be
    * created.
    */
   public void testQueueConnectionFactory() throws Exception
   {
      QueueConnectionFactory qcf =
         (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory");
      QueueConnection qc = qcf.createQueueConnection();
      qc.close();
   }
View Full Code Here

   /**
    * Test creation of QueueSession
    */
   public void testQueueConnection1() throws Exception
   {
      QueueConnectionFactory qcf = (QueueConnectionFactory)cf;

      QueueConnection qc = qcf.createQueueConnection();

      qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      qc.close();

View Full Code Here

TOP

Related Classes of javax.jms.QueueConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.