Package javax.jms

Examples of javax.jms.ConnectionFactory.createConnection()


    ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("topic");
    ConnectionFactory tcf = (ConnectionFactory) ictx.lookup("tcf");
    ictx.close();

    Connection cnx = tcf.createConnection();
    Session session = cnx.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
    TopicSubscriber subscriber = session.createDurableSubscriber(topic, "durable");
    subscriber.setMessageListener(new MsgListener());

    cnx.start();
View Full Code Here


      }
    } finally {
      ictx.close();
    }

    Connection cnx = cf.createConnection("anonymous", "anonymous");
    Session session = cnx.createSession(true, 0);
    MessageProducer pub = session.createProducer(dest);

    String location = System.getProperty("location");
    if (location != null)
View Full Code Here

    Topic topic = Topic.create(0,"topic");

    AdminModule.disconnect();


    Connection cnx = cf.createConnection("anonymous", "anonymous");
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer pub = sess.createProducer(topic);

    TextMessage msg = sess.createTextMessage();
View Full Code Here

    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    System.out.println("Trace2");

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer cons = sess.createConsumer(queue);

    System.out.println("Listens to the MailQueue...");
    System.out.println("hit a key to stop.");
View Full Code Here

    Queue queue = (Queue) ictx.lookup("queue");
    // Topic topic = (Topic) ictx.lookup("topic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer recv = sess.createConsumer(queue);
    // MessageConsumer subs = sess.createConsumer(topic);

    recv.setMessageListener(new MsgListener("Collector Queue listener"));
View Full Code Here

    Context ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("MonitoringTopic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer subs = sess.createConsumer(topic);

    subs.setMessageListener(new MonitorMsgListener());
View Full Code Here

    Context ictx = new InitialContext();
    Queue dmq = (Queue) ictx.lookup("dmq");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection("anonymous", "anonymous");

    Session session = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = session.createConsumer(dmq);

    cnx.start();
View Full Code Here

    Queue queue2 = (Queue) ictx.lookup("queue2");
//    Queue queue3 = (Queue) ictx.lookup("queue3");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session prodSession = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Session consSession = cnx.createSession(true, 0);
   
    MessageProducer producer = prodSession.createProducer(null);
    MessageConsumer consumer = consSession.createConsumer(queue1);
View Full Code Here

        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

                      String host, int port,
                      String user, String pass) throws ConnectException, AdminException {
    ConnectionFactory cf = TcpConnectionFactory.create(host, port);
    Connection cnx;
    try {
      cnx = cf.createConnection(user, pass);
      cnx.start();
      new JoramAdmin(cnx, name);
    } catch (JMSException exc) {
      // TODO Auto-generated catch block
      exc.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.