Package javax.jms

Examples of javax.jms.TopicConnectionFactory


                {
                    return connections.get(JMSType.TOPIC);
                }
                else
                {
                    TopicConnectionFactory ccf = (TopicConnectionFactory) createOrReturnConnectionFactory();
                    TopicConnection qc = ccf.createTopicConnection();
                    connections.put(JMSType.TOPIC, qc);

                    return qc;
                }
View Full Code Here


                                                       addrDetails.getConnectionPassword());
            } else {
                connection = qcf.createQueueConnection();
            }
        } else {
            TopicConnectionFactory tcf =
                (TopicConnectionFactory)context.lookup(addrDetails.getJndiConnectionFactoryName());
            if (addrDetails.isSetConnectionUserName()) {
                connection = tcf.createTopicConnection(addrDetails.getConnectionUserName(),
                                                       addrDetails.getConnectionPassword());
            } else {
                connection = tcf.createTopicConnection();
            }
        }
       
        if (null != jmsDestConfigBean) {
            String clientID = jmsDestConfigBean.getDurableSubscriptionClientId();
View Full Code Here

  /**
   *  Options are activated and become effective only after calling
   *  this method.*/
  public void activateOptions() {
    TopicConnectionFactory topicConnectionFactory;

    try {
      Context jndi;

      getLogger().debug("Getting initial context.");
      if (initialContextFactoryName != null) {
        Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
        if (providerURL != null) {
          env.put(Context.PROVIDER_URL, providerURL);
        } else {
          getLogger().warn(
            "You have set InitialContextFactoryName option but not the "
            + "ProviderURL. This is likely to cause problems.");
        }
        if (urlPkgPrefixes != null) {
          env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
        }

        if (securityPrincipalName != null) {
          env.put(Context.SECURITY_PRINCIPAL, securityPrincipalName);
          if (securityCredentials != null) {
            env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
          } else {
            getLogger().warn(
              "You have set SecurityPrincipalName option but not the "
              + "SecurityCredentials. This is likely to cause problems.");
          }
        }
        jndi = new InitialContext(env);
      } else {
        jndi = new InitialContext();
      }

      getLogger().debug("Looking up [" + tcfBindingName + "]");
      topicConnectionFactory =
        (TopicConnectionFactory) lookup(jndi, tcfBindingName);
      getLogger().debug("About to create TopicConnection.");
      if (userName != null) {
        topicConnection =
          topicConnectionFactory.createTopicConnection(userName, password);
      } else {
        topicConnection = topicConnectionFactory.createTopicConnection();
      }

      getLogger().debug(
        "Creating TopicSession, non-transactional, "
        + "in AUTO_ACKNOWLEDGE mode.");
View Full Code Here

                ctx = new InitialContext(p);
        }

        // give some more flexibility about the choice of a tab name
        providerUrl = (String)ctx.getEnvironment().get(Context.PROVIDER_URL);
        TopicConnectionFactory topicConnectionFactory;
        topicConnectionFactory =
          (TopicConnectionFactory) lookup(ctx, topicFactoryName);
       
        if (userId != null && password != null) {
          topicConnection =
             topicConnectionFactory.createTopicConnection(userId, password);
        } else {
          topicConnection =
             topicConnectionFactory.createTopicConnection();
        }
          
        TopicSession topicSession =
          topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
 
View Full Code Here

  public JMSSink( String tcfBindingName, String topicBindingName, String username,
      String password) {
   
    try {
      Context ctx = new InitialContext();
      TopicConnectionFactory topicConnectionFactory;
      topicConnectionFactory = (TopicConnectionFactory) lookup(ctx,
                                                               tcfBindingName);

      TopicConnection topicConnection =
                          topicConnectionFactory.createTopicConnection(username,
                       password);
      topicConnection.start();

      TopicSession topicSession = topicConnection.createTopicSession(false,
                                                       Session.AUTO_ACKNOWLEDGE);
View Full Code Here

     */
    private TopicConnection getTopicConnection(BrokerConfiguration brokerConfiguration)
            throws BrokerEventProcessingException {
        // create connection factory
        try {
            TopicConnectionFactory topicConnectionFactory =
                    (TopicConnectionFactory) createInitialContext(brokerConfiguration).
                            lookup(BrokerConstants.BROKER_CONF_JMS_QPID_PROP_CONNECTION_FACTORY_LOOK_UP_NAME);
            return topicConnectionFactory.createTopicConnection();
        } catch (NamingException e) {
            throw new BrokerEventProcessingException("Can not create topic connection factory.", e);
        } catch (JMSException e) {
            throw new BrokerEventProcessingException("Can not create topic connection .", e);
        }
View Full Code Here

            {
                throw new RuntimeException("Failed to get the root context");
            }

            // lookup the connection factory from the context
            TopicConnectionFactory factory = (TopicConnectionFactory)context.lookup("JmsTopicConnectionFactory");
            // if we can't find the factory then throw an exception
            if (factory == null)
            {
                throw new RuntimeException("Failed to locate connection factory");
            }
            System.out.println("Connection Factory ready");

            // Openning a connection with the connection Factory
            TopicConnection connection = factory.createTopicConnection();
            connection.start();
            System.out.println("Connection ready");

            // Openning a session within the connection
            TopicSession session = connection.createTopicSession(transacted, ackType);
View Full Code Here

            {
                throw new RuntimeException("Failed to get the root context");
            }

            // lookup the connection factory from the context
            TopicConnectionFactory factory = (TopicConnectionFactory)context.lookup("JmsTopicConnectionFactory");
            // if we can't find the factory then throw an exception
            if (factory == null)
            {
                throw new RuntimeException("Failed to locate connection factory");
            }
            System.out.println("Connection Factory ready");

            // Openning a connection with the connection Factory
            TopicConnection connection = factory.createTopicConnection();
            connection.start();
            System.out.println("Connection ready");

            // Openning a session within the connection
            TopicSession session = connection.createTopicSession(transacted, ackType);
View Full Code Here

              {
                throw new RuntimeException("Failed to get the root context");
              }

              // lookup the connection factory from the context
              TopicConnectionFactory factory = (TopicConnectionFactory)context.lookup("JmsTopicConnectionFactory");
              // if we can't find the factory then throw an exception
              if (factory == null)
              {
                  throw new RuntimeException("Failed to locate connection factory");
              }
              System.out.println("Connection Factory ready");

              // Create a connection with the ConnectionFactory
              TopicConnection connection = factory.createTopicConnection();
              connection.start();
              System.out.println("Connection ready");

              // Create a session within the connection
              TopicSession session = connection.createTopicSession(transacted,ackType);
View Full Code Here

              {
                throw new RuntimeException("Failed to get the root context");
              }

              // lookup the connection factory from the context
              TopicConnectionFactory factory = (TopicConnectionFactory)context.lookup("JmsTopicConnectionFactory");
              // if we can't find the factory then throw an exception
              if (factory == null)
              {
                  throw new RuntimeException("Failed to locate connection factory");
              }
              System.out.println("Connection Factory ready");

              // Create a connection with the ConnectionFactory
              TopicConnection connection = factory.createTopicConnection();
              connection.start();
              System.out.println("Connection ready");

              // Create a session within the connection
              TopicSession session = connection.createTopicSession(transacted,ackType);
View Full Code Here

TOP

Related Classes of javax.jms.TopicConnectionFactory

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.