Examples of ConnectionFactory


Examples of javax.jms.ConnectionFactory

    System.out.println();
    System.out.println("Requests to receive messages...");

    ictx = new InitialContext();
    Queue queue = (Queue) ictx.lookup("ftpQueue");
    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);
    Message msg;

    cnx.start();
View Full Code Here

Examples of javax.jms.ConnectionFactory

    // Connecting to JORAM server:
    AdminModule.connect("root", "root", 60);

    // Creating the JMS administered objects:       
    ConnectionFactory connFactory = TcpConnectionFactory.create("localhost", 16010);

    Topic topic = Topic.create(0);

    // Creating an access for user anonymous:
    User.create("anonymous", "anonymous", 0);
View Full Code Here

Examples of javax.jms.ConnectionFactory

  static Context ictx = null;

  public static void main(String[] args) throws Exception {
    ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("sendMailTopic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(true, 0);
    MessageProducer producer = sess.createProducer(topic);

    System.out.println("Produces 5 messages on the MailTopic.");
View Full Code Here

Examples of javax.jms.ConnectionFactory

    System.out.println("update properties on the collector queue...");

    ictx = new InitialContext();
    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);
    MessageProducer producer = sess.createProducer(null);

    Message msg = sess.createMessage();
    msg.setStringProperty("expiration", "0");
View Full Code Here

Examples of javax.jms.ConnectionFactory

  public static void main(String[] args)
    throws Exception {
    System.out.println();
    System.out.println("Subscribes and listens to topic...");

    ConnectionFactory cf = HATcpConnectionFactory.create("hajoram://localhost:2560,localhost:2561,localhost:2562");
    ((HATcpConnectionFactory)cf).getParameters().connectingTimer = 30;
   
    AdminModule.connect(cf, "root", "root");
   
    Topic topic = Topic.create(0,"topic");

    AdminModule.disconnect();

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

    sub.setMessageListener(new Listener());
View Full Code Here

Examples of javax.jms.ConnectionFactory

    System.out.println();
    System.out.println("Queries to the monitoring queue...");

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

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer prod = sess.createProducer(queue);
    MessageConsumer cons = sess.createConsumer(queue);
    cnx.start();
View Full Code Here

Examples of javax.jms.ConnectionFactory

   {
      log.info("testNonTxSendReceiveNP");
      //Thread.sleep(10000);
     
      InitialContext initialContext = new InitialContext(ServerManagement.getJNDIEnvironment());
      ConnectionFactory cf = (JBossConnectionFactory)initialContext.lookup("/ConnectionFactory");

      ServerManagement.deployQueue("Queue", 10000, 1000, 1000);
     
      Queue queue = (Queue)initialContext.lookup("/queue/Queue");
     
      Connection conn = cf.createConnection();

      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      MessageProducer prod = sess.createProducer(queue);
View Full Code Here

Examples of javax.jms.ConnectionFactory

   {
      log.info("testExpressionParsingMessages");
      //Thread.sleep(10000);
     
      InitialContext initialContext = new InitialContext(ServerManagement.getJNDIEnvironment());
      ConnectionFactory cf = (JBossConnectionFactory)initialContext.lookup("/ConnectionFactory");

      ServerManagement.deployQueue("Queue", 10000, 1000, 1000);
     
      Queue queue = (Queue)initialContext.lookup("/queue/Queue");
     
      Connection conn = cf.createConnection();

      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      MessageProducer prod = sess.createProducer(queue);
View Full Code Here

Examples of javax.jms.ConnectionFactory

      super.tearDown();
   }
  
   public void testRelay() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
     
      Topic topic = (Topic)ic.lookup("/topic/StressTestTopic");
     
      final int numMessages = 20000;
     
      final int numRelayers = 5;
     
      final int numConsumers = 20;
     
      Connection conn = cf.createConnection();
     
      class Relayer implements MessageListener
      {
         boolean done;
        
View Full Code Here

Examples of javax.jms.ConnectionFactory

   private Connection createConnection(String username, String password, ConnectionFactoryFactory cff)
      throws Exception
   {
      Connection conn;
     
      ConnectionFactory cf = cff.createConnectionFactory();
     
      if (qualityOfServiceMode == QOS_ONCE_AND_ONLY_ONCE &&
          !(cf instanceof XAConnectionFactory))
      {
         throw new IllegalArgumentException("Connection factory must be XAConnectionFactory");
      }
     
      if (username == null)
      {
         if (qualityOfServiceMode == QOS_ONCE_AND_ONLY_ONCE)
         {
            if (trace) { log.trace("Creating an XA connection"); }
            conn = ((XAConnectionFactory)cf).createXAConnection();
         }
         else
         {
            if (trace) { log.trace("Creating a non XA connection"); }
            conn = cf.createConnection();           
         }
      }
      else
      {
         if (qualityOfServiceMode == QOS_ONCE_AND_ONLY_ONCE)
         {
            if (trace) { log.trace("Creating an XA connection"); }
            conn = ((XAConnectionFactory)cf).createXAConnection(username, password);
         }
         else
         {
            if (trace) { log.trace("Creating a non XA connection"); }
            conn = cf.createConnection(username, password);           
        
      }
      return conn;
   }
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.