Package javax.jms

Examples of javax.jms.TopicSession


   public TopicSubscriber createSubscriber(final Topic topic) throws JMSException
   {
      lock();
      try
      {
         TopicSession session = getTopicSessionInternal();

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createSubscriber " + session + " topic=" + topic);
         }

         TopicSubscriber result = session.createSubscriber(topic);
         result = new HornetQRATopicSubscriber(result, this);

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createdSubscriber " + session + " HornetQTopicSubscriber=" + result);
View Full Code Here


   public TopicSubscriber createSubscriber(final Topic topic, final String messageSelector, final boolean noLocal) throws JMSException
   {
      lock();
      try
      {
         TopicSession session = getTopicSessionInternal();

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createSubscriber " + session +
                                       " topic=" +
                                       topic +
                                       " selector=" +
                                       messageSelector +
                                       " noLocal=" +
                                       noLocal);
         }

         TopicSubscriber result = session.createSubscriber(topic, messageSelector, noLocal);
         result = new HornetQRATopicSubscriber(result, this);

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createdSubscriber " + session + " HornetQTopicSubscriber=" + result);
View Full Code Here

   public TopicPublisher createPublisher(final Topic topic) throws JMSException
   {
      lock();
      try
      {
         TopicSession session = getTopicSessionInternal();

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createPublisher " + session + " topic=" + topic);
         }

         TopicPublisher result = session.createPublisher(topic);
         result = new HornetQRATopicPublisher(result, this);

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createdPublisher " + session + " publisher=" + result);
View Full Code Here

   }

   public void testCreateQueueOnATopicSession() throws Exception
   {
      TopicConnection c = (TopicConnection)getConnectionFactory().createConnection();
      TopicSession s = c.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      try
      {
         s.createQueue("TestQueue");
         ProxyAssertSupport.fail("should throw IllegalStateException");
      }
      catch (javax.jms.IllegalStateException e)
      {
         // OK
View Full Code Here

   public void testCannotReceiveMessageOnStoppedConnection() throws Exception
   {
      TopicConnection conn1 = ((TopicConnectionFactory)JMSTestCase.topicCf).createTopicConnection();
      TopicConnection conn2 = ((TopicConnectionFactory)JMSTestCase.topicCf).createTopicConnection();

      TopicSession sess1 = conn1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TopicSession sess2 = conn2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      TopicSubscriber sub1 = sess1.createSubscriber(HornetQServerTestCase.topic1);
      TopicSubscriber sub2 = sess2.createSubscriber(HornetQServerTestCase.topic1);

      conn1.start();

      Connection conn3 = JMSTestCase.cf.createConnection();
View Full Code Here

   {
      TopicConnection conn = getTopicConnectionFactory().createTopicConnection();

      try
      {
         TopicSession s = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         TopicPublisher publisher = s.createPublisher(HornetQServerTestCase.topic1);
         TopicSubscriber sub = s.createSubscriber(HornetQServerTestCase.topic1);
         conn.start();

         // Create 3 object messages with different bodies

         TestObject to1 = new TestObject();
         to1.text = "hello1";

         TestObject to2 = new TestObject();
         to1.text = "hello2";

         TestObject to3 = new TestObject();
         to1.text = "hello3";

         ObjectMessage om1 = s.createObjectMessage();
         om1.setObject(to1);

         ObjectMessage om2 = s.createObjectMessage();
         om2.setObject(to2);

         ObjectMessage om3 = s.createObjectMessage();
         om3.setObject(to3);

         // send to topic
         publisher.send(om1);
View Full Code Here

      try
      {
         consumerConnection = JMSTestCase.cf.createConnection();
         TopicConnection tc = (TopicConnection)consumerConnection;

         TopicSession consumerSession = tc.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         TopicSubscriber topicConsumer = consumerSession.createSubscriber(HornetQServerTestCase.topic1);

         topicConsumer.close();

         try
         {
View Full Code Here

      try
      {
         conn = JMSTestCase.cf.createTopicConnection();

         TopicSession ts = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         try
         {
            ts.createSubscriber(null);
            ProxyAssertSupport.fail("this should fail");
         }
         catch (javax.jms.InvalidDestinationException e)
         {
            // OK
View Full Code Here

      try
      {
         conn = JMSTestCase.cf.createTopicConnection();
         conn.setClientID("sofiavergara");

         TopicSession ts = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         try
         {
            ts.unsubscribe("invalid-subscription-name");
            ProxyAssertSupport.fail("this should fail");
         }
         catch (javax.jms.InvalidDestinationException e)
         {
            // OK
View Full Code Here

      try
      {
         c = JMSTestCase.cf.createTopicConnection();
         c.setClientID("something");

         TopicSession s = c.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

         try
         {
            s.createSubscriber(HornetQServerTestCase.topic1, "=TEST 'test'", false);
            ProxyAssertSupport.fail("this should fail");
         }
         catch (InvalidSelectorException e)
         {
            // OK
View Full Code Here

TOP

Related Classes of javax.jms.TopicSession

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.