Examples of JMSBridgeImpl


Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

      messageIDInHeader(false);
   }

   private void messageIDInHeader(final boolean on) throws Exception
   {
      JMSBridgeImpl bridge = null;

      Connection connSource = null;

      Connection connTarget = null;

      try
      {
         final int NUM_MESSAGES = 10;

         bridge = new JMSBridgeImpl(cff0,
                                    cff1,
                                    sourceQueueFactory,
                                    targetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    QualityOfServiceMode.AT_MOST_ONCE,
                                    1,
                                    -1,
                                    null,
                                    null,
                                    on);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         connSource = cf0.createConnection();

         connTarget = cf1.createConnection();

         JMSBridgeTest.log.trace("Sending " + NUM_MESSAGES + " messages");

         List ids1 = new ArrayList();

         Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageProducer prod = sessSource.createProducer(sourceQueue);

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            TextMessage tm = sessSource.createTextMessage("message" + i);

            // We add some properties to make sure they get passed through ok
            tm.setStringProperty("wib", "uhuh");
            tm.setBooleanProperty("cheese", true);
            tm.setIntProperty("Sausages", 23);
            tm.setByteProperty("bacon", (byte)12);
            tm.setDoubleProperty("toast", 17261762.12121d);
            tm.setFloatProperty("orange", 1212.1212f);
            tm.setLongProperty("blurg", 817217827l);
            tm.setShortProperty("stst", (short)26363);
           
            //Set some JMS headers too
           
            //And also set a core props
            ((HornetQMessage)tm).getCoreMessage().putBytesProperty("bytes", new byte[] { 1, 2, 3});

            // We add some JMSX ones too

            tm.setStringProperty("JMSXGroupID", "mygroup543");

            prod.send(tm);

            ids1.add(tm.getJMSMessageID());
         }

         JMSBridgeTest.log.trace("Sent the first messages");

         Session sessTarget = connTarget.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageConsumer cons = sessTarget.createConsumer(targetQueue);

         connTarget.start();

         List msgs = new ArrayList();

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            TextMessage tm = (TextMessage)cons.receive(5000);

            Assert.assertNotNull(tm);

            Assert.assertEquals("message" + i, tm.getText());

            Assert.assertEquals("uhuh", tm.getStringProperty("wib"));
            Assert.assertTrue(tm.getBooleanProperty("cheese"));
            Assert.assertEquals(23, tm.getIntProperty("Sausages"));
            assertEquals((byte)12, tm.getByteProperty("bacon"));
            assertEquals(17261762.12121d, tm.getDoubleProperty("toast"));
            assertEquals(1212.1212f, tm.getFloatProperty("orange"));
            assertEquals(817217827l, tm.getLongProperty("blurg"));
            assertEquals((short)26363, tm.getShortProperty("stst"));
           
            assertEqualsByteArrays(new byte[] { 1,2, 3}, ((HornetQMessage)tm).getCoreMessage().getBytesProperty("bytes"));

            Assert.assertEquals("mygroup543", tm.getStringProperty("JMSXGroupID"));

            if (on)
            {
               String header = tm.getStringProperty(HornetQJMSConstants.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST);

               Assert.assertNotNull(header);

               Assert.assertEquals(ids1.get(i), header);

               msgs.add(tm);
            }
         }

         if (on)
         {
            // Now we send them again back to the source

            Iterator iter = msgs.iterator();

            List ids2 = new ArrayList();

            while (iter.hasNext())
            {
               Message msg = (Message)iter.next();

               prod.send(msg);

               ids2.add(msg.getJMSMessageID());
            }

            // And consume them again

            for (int i = 0; i < NUM_MESSAGES; i++)
            {
               TextMessage tm = (TextMessage)cons.receive(5000);

               Assert.assertNotNull(tm);

               Assert.assertEquals("message" + i, tm.getText());

               Assert.assertEquals("uhuh", tm.getStringProperty("wib"));
               Assert.assertTrue(tm.getBooleanProperty("cheese"));
               Assert.assertEquals(23, tm.getIntProperty("Sausages"));
               assertEquals((byte)12, tm.getByteProperty("bacon"));
               assertEquals(17261762.12121d, tm.getDoubleProperty("toast"));
               assertEquals(1212.1212f, tm.getFloatProperty("orange"));
               assertEquals(817217827l, tm.getLongProperty("blurg"));
               assertEquals((short)26363, tm.getShortProperty("stst"));
              
               assertEqualsByteArrays(new byte[] { 1,2, 3}, ((HornetQMessage)tm).getCoreMessage().getBytesProperty("bytes"));

               Assert.assertEquals("mygroup543", tm.getStringProperty("JMSXGroupID"));

               String header = tm.getStringProperty(HornetQJMSConstants.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST);

               Assert.assertNotNull(header);

               Assert.assertEquals(ids1.get(i) + "," + ids2.get(i), header);
            }
         }

      }
      finally
      {
         if (bridge != null)
         {
            bridge.stop();
         }

         if (connSource != null)
         {
            connSource.close();
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

      propertiesPreserved(true, true);
   }

   private void propertiesPreserved(final boolean persistent, final boolean messageIDInHeader) throws Exception
   {
      JMSBridgeImpl bridge = null;

      Connection connSource = null;

      Connection connTarget = null;

      try
      {
         final int NUM_MESSAGES = 10;

         bridge = new JMSBridgeImpl(cff0,
                                    cff1,
                                    sourceQueueFactory,
                                    targetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    QualityOfServiceMode.AT_MOST_ONCE,
                                    1,
                                    -1,
                                    null,
                                    null,
                                    messageIDInHeader);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         connSource = cf0.createConnection();

         connTarget = cf1.createConnection();

         JMSBridgeTest.log.trace("Sending " + NUM_MESSAGES + " messages");

         Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);

         Session sessTarget = connTarget.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageConsumer cons = sessTarget.createConsumer(targetQueue);

         connTarget.start();

         MessageProducer prod = sessSource.createProducer(sourceQueue);

         prod.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);

         TextMessage tm = sessSource.createTextMessage("blahmessage");

         prod.setPriority(7);

         prod.setTimeToLive(1 * 60 * 60 * 1000);

         prod.send(tm);

         long expiration = tm.getJMSExpiration();

         Assert.assertEquals(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT,
                             tm.getJMSDeliveryMode());

         tm = (TextMessage)cons.receive(1000);

         Assert.assertNotNull(tm);

         Assert.assertEquals("blahmessage", tm.getText());

         Assert.assertEquals(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT,
                             tm.getJMSDeliveryMode());

         Assert.assertEquals(7, tm.getJMSPriority());

         Assert.assertTrue(Math.abs(expiration - tm.getJMSExpiration()) < 100);

         Message m = cons.receive(5000);

         Assert.assertNull(m);

         // Now do one with expiration = 0

         tm = sessSource.createTextMessage("blahmessage2");

         prod.setPriority(7);

         prod.setTimeToLive(0);

         prod.send(tm);

         Assert.assertEquals(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT,
                             tm.getJMSDeliveryMode());

         tm = (TextMessage)cons.receive(1000);

         Assert.assertNotNull(tm);

         Assert.assertEquals("blahmessage2", tm.getText());

         Assert.assertEquals(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT,
                             tm.getJMSDeliveryMode());

         Assert.assertEquals(7, tm.getJMSPriority());

         Assert.assertEquals(0, tm.getJMSExpiration());

         m = cons.receive(5000);

         Assert.assertNull(m);

         tm = sessSource.createTextMessage("blahmessage3");

         final boolean myBool = false;
         final byte myByte = (byte)23;
         final double myDouble = 17625765d;
         final float myFloat = 87127.23f;
         final int myInt = 123;
         final long myLong = 81728712;
         final short myShort = (short)88;
         final String myString = "ojweodewj";
         final String myJMSX = "aardvark";

         tm.setBooleanProperty("mybool", myBool);
         tm.setByteProperty("mybyte", myByte);
         tm.setDoubleProperty("mydouble", myDouble);
         tm.setFloatProperty("myfloat", myFloat);
         tm.setIntProperty("myint", myInt);
         tm.setLongProperty("mylong", myLong);
         tm.setShortProperty("myshort", myShort);
         tm.setStringProperty("mystring", myString);

         tm.setStringProperty("JMSXMyNaughtyJMSXProperty", myJMSX);

         prod.send(tm);

         tm = (TextMessage)cons.receive(5000);

         Assert.assertNotNull(tm);

         Assert.assertEquals("blahmessage3", tm.getText());

         Assert.assertEquals(myBool, tm.getBooleanProperty("mybool"));
         Assert.assertEquals(myByte, tm.getByteProperty("mybyte"));
         Assert.assertEquals(myDouble, tm.getDoubleProperty("mydouble"));
         Assert.assertEquals(myFloat, tm.getFloatProperty("myfloat"));
         Assert.assertEquals(myInt, tm.getIntProperty("myint"));
         Assert.assertEquals(myLong, tm.getLongProperty("mylong"));
         Assert.assertEquals(myShort, tm.getShortProperty("myshort"));
         Assert.assertEquals(myString, tm.getStringProperty("mystring"));
         Assert.assertEquals(myJMSX, tm.getStringProperty("JMSXMyNaughtyJMSXProperty"));

         m = cons.receive(5000);

      }
      finally
      {
         if (bridge != null)
         {
            bridge.stop();
         }

         if (connSource != null)
         {
            connSource.close();
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

      }
   }

   public void testNoMessageIDInHeader() throws Exception
   {
      JMSBridgeImpl bridge = null;

      Connection connSource = null;

      Connection connTarget = null;

      try
      {
         final int NUM_MESSAGES = 10;

         bridge = new JMSBridgeImpl(cff0,
                                    cff1,
                                    sourceQueueFactory,
                                    targetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    QualityOfServiceMode.AT_MOST_ONCE,
                                    1,
                                    -1,
                                    null,
                                    null,
                                    false);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         connSource = cf0.createConnection();

         connTarget = cf1.createConnection();

         JMSBridgeTest.log.trace("Sending " + NUM_MESSAGES + " messages");

         Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageProducer prod = sessSource.createProducer(sourceQueue);

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            TextMessage tm = sessSource.createTextMessage("message" + i);

            // We add some headers to make sure they get passed through ok
            tm.setStringProperty("wib", "uhuh");
            tm.setBooleanProperty("cheese", true);
            tm.setIntProperty("Sausages", 23);

            prod.send(tm);
         }

         JMSBridgeTest.log.trace("Sent the first messages");

         Session sessTarget = connTarget.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageConsumer cons = sessTarget.createConsumer(targetQueue);

         connTarget.start();

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            TextMessage tm = (TextMessage)cons.receive(5000);

            Assert.assertNotNull(tm);

            Assert.assertEquals("message" + i, tm.getText());

            Assert.assertEquals("uhuh", tm.getStringProperty("wib"));
            Assert.assertTrue(tm.getBooleanProperty("cheese"));
            Assert.assertEquals(23, tm.getIntProperty("Sausages"));

            String header = tm.getStringProperty(HornetQJMSConstants.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST);

            Assert.assertNull(header);
         }
      }
      finally
      {
         if (bridge != null)
         {
            bridge.stop();
         }

         if (connSource != null)
         {
            connSource.close();
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

   private void testStress(final QualityOfServiceMode qosMode, final boolean persistent, final int batchSize) throws Exception
   {
      Connection connSource = null;

      JMSBridgeImpl bridge = null;

      Thread t = null;

      ConnectionFactoryFactory factInUse0 = cff0;
      ConnectionFactoryFactory factInUse1 = cff1;
      if (qosMode.equals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE))
      {
         factInUse0 = cff0xa;
         factInUse1 = cff1xa;
      }

      try
      {
         bridge = new JMSBridgeImpl(factInUse0,
                                    factInUse1,
                                    sourceQueueFactory,
                                    targetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    qosMode,
                                    batchSize,
                                    -1,
                                    null,
                                    null,
                                    false);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         connSource = cf0.createConnection();

         Session sessSend = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageProducer prod = sessSend.createProducer(sourceQueue);

         final int NUM_MESSAGES = 250;

         StressSender sender = new StressSender();
         sender.sess = sessSend;
         sender.prod = prod;
         sender.numMessages = NUM_MESSAGES;
         prod.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);

         t = new Thread(sender);

         t.start();

         checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES, false);

         t.join();

         if (sender.ex != null)
         {
            // An error occurred during the send
            throw sender.ex;
         }

      }
      finally
      {
         if (t != null)
         {
            t.join(10000);
         }

         if (connSource != null)
         {
            try
            {
               connSource.close();
            }
            catch (Exception e)
            {
               JMSBridgeTest.log.error("Failed to close connection", e);
            }
         }

         if (bridge != null)
         {
            bridge.stop();
         }
      }
   }
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

   private void testStressBatchTime(final QualityOfServiceMode qosMode, final boolean persistent, final int maxBatchTime) throws Exception
   {
      Connection connSource = null;

      JMSBridgeImpl bridge = null;

      Thread t = null;

      ConnectionFactoryFactory factInUse0 = cff0;
      ConnectionFactoryFactory factInUse1 = cff1;
      if (qosMode.equals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE))
      {
         factInUse0 = cff0xa;
         factInUse1 = cff1xa;
      }

      try
      {
         bridge = new JMSBridgeImpl(factInUse0,
                                    factInUse1,
                                    sourceQueueFactory,
                                    targetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    qosMode,
                                    2,
                                    maxBatchTime,
                                    null,
                                    null,
                                    false);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         connSource = cf0.createConnection();

         Session sessSend = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageProducer prod = sessSend.createProducer(sourceQueue);

         final int NUM_MESSAGES = 5000;

         StressSender sender = new StressSender();
         sender.sess = sessSend;
         sender.prod = prod;
         sender.numMessages = NUM_MESSAGES;
         prod.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);

         t = new Thread(sender);

         t.start();

         checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES, false);

         t.join();

         if (sender.ex != null)
         {
            // An error occurred during the send
            throw sender.ex;
         }

      }
      finally
      {
         if (t != null)
         {
            t.join(10000);
         }

         if (connSource != null)
         {
            try
            {
               connSource.close();
            }
            catch (Exception e)
            {
               JMSBridgeTest.log.error("Failed to close connection", e);
            }
         }

         if (bridge != null)
         {
            bridge.stop();
         }
      }
   }
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

   // Both source and destination on same rm
   private void testStressSameServer(final QualityOfServiceMode qosMode, final boolean persistent, final int batchSize) throws Exception
   {
      Connection connSource = null;

      JMSBridgeImpl bridge = null;

      Thread t = null;

      ConnectionFactoryFactory factInUse0 = cff0;
      if (qosMode.equals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE))
      {
         factInUse0 = cff0xa;
      }

      try
      {
         bridge = new JMSBridgeImpl(factInUse0,
                                    factInUse0,
                                    sourceQueueFactory,
                                    localTargetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    qosMode,
                                    batchSize,
                                    -1,
                                    null,
                                    null,
                                    false);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         connSource = cf0.createConnection();

         Session sessSend = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageProducer prod = sessSend.createProducer(sourceQueue);

         final int NUM_MESSAGES = 2000;

         StressSender sender = new StressSender();
         sender.sess = sessSend;
         sender.prod = prod;
         sender.numMessages = NUM_MESSAGES;
         prod.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);

         t = new Thread(sender);

         t.start();

         checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES, false);

         t.join();

         if (sender.ex != null)
         {
            // An error occurred during the send
            throw sender.ex;
         }

      }
      finally
      {
         if (t != null)
         {
            t.join(10000);
         }

         if (connSource != null)
         {
            try
            {
               connSource.close();
            }
            catch (Exception e)
            {
               JMSBridgeTest.log.error("Failed to close connection", e);
            }
         }

         if (bridge != null)
         {
            bridge.stop();
         }
      }
   }
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

      }
   }

   private void testNoMaxBatchTime(final QualityOfServiceMode qosMode, final boolean persistent) throws Exception
   {
      JMSBridgeImpl bridge = null;

      ConnectionFactoryFactory factInUse0 = cff0;
      ConnectionFactoryFactory factInUse1 = cff1;
      if (qosMode.equals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE))
      {
         factInUse0 = cff0xa;
         factInUse1 = cff1xa;
      }
      try
      {
         final int NUM_MESSAGES = 10;

         bridge = new JMSBridgeImpl(factInUse0,
                                    factInUse1,
                                    sourceQueueFactory,
                                    targetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    qosMode,
                                    NUM_MESSAGES,
                                    -1,
                                    null,
                                    null,
                                    false);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         // Send half the messges

         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2, persistent, false);

         // Verify none are received

         checkEmpty(targetQueue, 1);

         // Send the other half

         sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent, false);

         // This should now be receivable

         checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES, false);

         // Send another batch with one more than batch size

         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES + 1, persistent, false);

         // Make sure only batch size are received

         checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES, false);

         // Final batch

         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES - 1, persistent, false);

         checkAllMessageReceivedInOrder(cf1, targetQueue, NUM_MESSAGES, 1, false);

         checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES - 1, false);
      }
      finally
      {
         if (bridge != null)
         {
            JMSBridgeTest.log.info("Stopping bridge");
            bridge.stop();
         }
      }
   }
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

      }
   }

   private void testNoMaxBatchTimeSameServer(final QualityOfServiceMode qosMode, final boolean persistent) throws Exception
   {
      JMSBridgeImpl bridge = null;

      ConnectionFactoryFactory factInUse0 = cff0;
      if (qosMode.equals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE))
      {
         factInUse0 = cff0xa;
      }

      try
      {
         final int NUM_MESSAGES = 10;

         bridge = new JMSBridgeImpl(factInUse0,
                                    factInUse0,
                                    sourceQueueFactory,
                                    localTargetQueueFactory,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    5000,
                                    10,
                                    qosMode,
                                    NUM_MESSAGES,
                                    -1,
                                    null,
                                    null,
                                    false);
         bridge.setTransactionManager(newTransactionManager());

         bridge.start();

         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2, persistent, false);

         checkEmpty(targetQueue, 1);

         // Send the other half

         sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent, false);

         // This should now be receivable

         checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES, false);

         checkEmpty(localTargetQueue, 0);

         checkEmpty(sourceQueue, 0);

         // Send another batch with one more than batch size

         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES + 1, persistent, false);

         // Make sure only batch size are received

         checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES, false);

         // Final batch

         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES - 1, persistent, false);

         checkAllMessageReceivedInOrder(cf0, localTargetQueue, NUM_MESSAGES, 1, false);

         checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES - 1, false);
      }
      finally
      {
         if (bridge != null)
         {
            bridge.stop();
         }
      }
   }
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

            if (moduleName != null) {
                ModuleIdentifier moduleID = ModuleIdentifier.create(moduleName);
                Module module = Module.getCallerModuleLoader().loadModule(moduleID);
                WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
            }
            return new JMSBridgeImpl(sourceCff,
                    targetCff,
                    sourceDestinationFactory,
                    targetDestinationFactory,
                    sourceUsername,
                    sourcePassword,
View Full Code Here

Examples of org.hornetq.jms.bridge.impl.JMSBridgeImpl

   public void testRetryConnectionOnStartup() throws Exception
   {
      jmsServer1.stop();

      JMSBridgeImpl bridge = new JMSBridgeImpl(cff0,
                                               cff1,
                                               sourceQueueFactory,
                                               targetQueueFactory,
                                               null,
                                               null,
                                               null,
                                               null,
                                               null,
                                               1000,
                                               -1,
                                               QualityOfServiceMode.DUPLICATES_OK,
                                               10,
                                               -1,
                                               null,
                                               null,
                                               false);
      bridge.setTransactionManager(newTransactionManager());

      try
      {
         bridge.start();
         Assert.assertFalse(bridge.isStarted());
         Assert.assertTrue(bridge.isFailed());

         // Restart the server
         jmsServer1.start();

         createQueue("targetQueue", 1);
         setUpAdministeredObjects();

         Thread.sleep(3000);

         Assert.assertTrue(bridge.isStarted());
         Assert.assertFalse(bridge.isFailed());
      }
      finally
      {
         try
         {
            bridge.stop();
         }
         catch (Exception e)
         {
            JMSBridgeReconnectionTest.log.error("Failed to stop bridge", e);
         }
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.