Examples of TopicConnectionFactory


Examples of javax.jms.TopicConnectionFactory

   public void testTopicSelectorChange() throws Exception
   {
      getLog().debug("Starting TopicSelectorChange test");

      getLog().debug("Create topic connection");
      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
      topicConnection = topicFactory.createTopicConnection("john", "needle");
      topicConnection.start();

      try
      {
         getLog().debug("Retrieving Topic");
View Full Code Here

Examples of javax.jms.TopicConnectionFactory

   public void testTopicSelectorNullOrEmpty() throws Exception
   {
      getLog().debug("Starting TopicSelectorNullOrEmpty test");

      getLog().debug("Create topic connection");
      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
      topicConnection = topicFactory.createTopicConnection("john", "needle");
      topicConnection.start();

      try
      {
         getLog().debug("Retrieving Topic");
View Full Code Here

Examples of javax.jms.TopicConnectionFactory

    * Test that ConnectionFactory can be cast to TopicConnectionFactory and TopicConnection can be
    * created.
    */
   public void testTopicConnectionFactory() throws Exception
   {
      TopicConnectionFactory qcf = (TopicConnectionFactory)ic.lookup("/ConnectionFactory");
      TopicConnection tc = qcf.createTopicConnection();
      tc.close();
   }
View Full Code Here

Examples of javax.jms.TopicConnectionFactory

                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

Examples of javax.jms.TopicConnectionFactory

  /**
   *  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) {
        this.topicConnection =
          topicConnectionFactory.createTopicConnection(userName, password);
      } else {
        this.topicConnection = topicConnectionFactory.createTopicConnection();
      }

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

Examples of javax.jms.TopicConnectionFactory

    private static TopicInfo connect(final Context context, final String factoryBindingName,
                                     final String queueBindingName, final String userName, final String password,
                                     final boolean suppress) throws Exception {
        try {
            final TopicConnectionFactory factory = (TopicConnectionFactory) lookup(context, factoryBindingName);
            TopicConnection conn;
            if (userName != null) {
                conn = factory.createTopicConnection(userName, password);
            } else {
                conn = factory.createTopicConnection();
            }
            final TopicSession sess = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            final Topic topic = (Topic) lookup(context, queueBindingName);
            final TopicPublisher publisher = sess.createPublisher(topic);
            conn.start();
View Full Code Here

Examples of javax.jms.TopicConnectionFactory

     */
    public JMSTopicReceiver(final String tcfBindingName, final String topicBindingName, final String username,
                            final String password) {
        try {
            final Context ctx = new InitialContext();
            TopicConnectionFactory topicConnectionFactory;
            topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName);
            final TopicConnection topicConnection = topicConnectionFactory.createTopicConnection(username, password);
            topicConnection.start();
            final TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            final Topic topic = (Topic) ctx.lookup(topicBindingName);
            final TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic);
            topicSubscriber.setMessageListener(this);
View Full Code Here

Examples of javax.jms.TopicConnectionFactory

    * Test that ConnectionFactory can be cast to TopicConnectionFactory and TopicConnection can be
    * created.
    */
   public void testTopicConnectionFactory() throws Exception
   {
      TopicConnectionFactory qcf = (TopicConnectionFactory)ic.lookup("/ConnectionFactory");
      TopicConnection tc = qcf.createTopicConnection();
      tc.close();
   }
View Full Code Here

Examples of javax.jms.TopicConnectionFactory

    * Test that ConnectionFactory can be cast to TopicConnectionFactory and TopicConnection can be
    * created.
    */
   public void testTopicConnectionFactory() throws Exception
   {
      TopicConnectionFactory qcf = (TopicConnectionFactory)JMSTestCase.ic.lookup("/CF_TOPIC_XA_FALSE");
      TopicConnection tc = qcf.createTopicConnection();
      tc.close();
   }
View Full Code Here

Examples of javax.jms.TopicConnectionFactory

      QueueConnectionFactory queueCF = (QueueConnectionFactory)JMSTestCase.ic.lookup("/CF_QUEUE");
      queueConnection = queueCF.createQueueConnection();
      assertConnectionType(queueConnection, "queue");

      TopicConnectionFactory topicCF = (TopicConnectionFactory)JMSTestCase.ic.lookup("/CF_TOPIC");
      topicConnection = topicCF.createTopicConnection();
      assertConnectionType(topicConnection, "topic");

      XAQueueConnectionFactory xaQueueCF = (XAQueueConnectionFactory)JMSTestCase.ic.lookup("/CF_QUEUE_XA_TRUE");
      xaQueueConnection = xaQueueCF.createXAQueueConnection();
      assertConnectionType(xaQueueConnection, "xa-queue");
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.