Package org.jboss.jms.server.bridge

Examples of org.jboss.jms.server.bridge.Bridge$SourceListener


   }
  
     
   private void testNoMaxBatchTime(int qosMode, boolean persistent) throws Exception
   {
      Bridge bridge = null;
           
      try
      {
         final int NUM_MESSAGES = 10;
        
         bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                             "/ConnectionFactory", "/ConnectionFactory",
                             null, null, null, null,
                             null, 5000, 10, qosMode,
                             NUM_MESSAGES, -1, null, null, false);
        
         bridge.start();
           
         //Send half the messges

         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2, persistent);
                        
         //Verify none are received
        
         this.checkEmpty(targetQueue, 1);
        
         //Send the other half
        
         this.sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent);
        
         //This should now be receivable
        
         this.checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES);
        
         //Send another batch with one more than batch size
        
         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES + 1, persistent);
                 
         //Make sure only batch size are received
        
         this.checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES);
        
         //Final batch
        
         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES - 1, persistent);
        
         this.checkAllMessageReceivedInOrder(cf1, targetQueue, NUM_MESSAGES, 1);
        
         this.checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES - 1);
      }
      finally
      {     
         if (bridge != null)
         {
            log.info("Stopping bridge");
            bridge.stop();
         }        
      }                 
   }
View Full Code Here


      }                 
   }
  
   private void testNoMaxBatchTimeSameServer(int qosMode, boolean persistent) throws Exception
   {
      Bridge bridge = null;
           
      try
      {
         final int NUM_MESSAGES = 10;
        
         bridge = new Bridge(true, sourceProps, sourceProps, "/queue/sourceQueue", "/queue/localTargetQueue",
                             "/ConnectionFactory", "/ConnectionFactory",
                             null, null, null, null,
                             null, 5000, 10, qosMode,
                             NUM_MESSAGES, -1, null, null, false);
        
         bridge.start();
           
         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2, persistent);
        
         this.checkEmpty(targetQueue, 1);               
        
         //Send the other half
        
         this.sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES /2, persistent);
        
        
         //This should now be receivable
        
         this.checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES);
        
         this.checkEmpty(localTargetQueue, 0);
        
         this.checkEmpty(sourceQueue, 0);
        
         //Send another batch with one more than batch size
        
         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES + 1, persistent);
        
         //Make sure only batch size are received
        
         this.checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES);
        
         //Final batch
        
         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES - 1, persistent);
        
         this.checkAllMessageReceivedInOrder(cf0, localTargetQueue, NUM_MESSAGES, 1);
        
         this.checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES - 1);
      }
      finally
      {              
         if (bridge != null)
         {
            bridge.stop();
         }                 
      }                 
   }
View Full Code Here

      }                 
   }
  
   private void testMaxBatchTime(int qosMode, boolean persistent) throws Exception
   {
      Bridge bridge = null;
           
      try
      {
         final long MAX_BATCH_TIME = 3000;
        
         final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it
        
         bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                             "/ConnectionFactory", "/ConnectionFactory",
                             null, null, null, null,
                             null, 3000, 10, qosMode,
                             MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false);
        
         bridge.start();
           
         final int NUM_MESSAGES = 10;
        
         //Send some message

         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES, persistent);                
        
         //Verify none are received
        
         this.checkEmpty(targetQueue, 1);
        
         //Messages should now be receivable
        
         this.checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES);        
      }
      finally
      {     
         if (bridge != null)
         {
            bridge.stop();
         }        
      }                 
   }
View Full Code Here

      }                 
   }
  
   private void testMaxBatchTimeSameServer(int qosMode, boolean persistent) throws Exception
   {
      Bridge bridge = null;
           
      try
      {
         final long MAX_BATCH_TIME = 3000;
        
         final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it
        
         bridge = new Bridge(true, sourceProps, sourceProps, "/queue/sourceQueue", "/queue/localTargetQueue",
                             "/ConnectionFactory", "/ConnectionFactory",
                             null, null, null, null,
                             null, 3000, 10, qosMode,
                             MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false);
        
         bridge.start();
        
         final int NUM_MESSAGES = 10;
        
         //Send some message

         //Send some message

         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES, persistent);                
        
         //Verify none are received
        
         this.checkEmpty(localTargetQueue, 0);;
        
         //Messages should now be receivable
        
         this.checkAllMessageReceivedInOrder(cf0, localTargetQueue, 0, NUM_MESSAGES);
      }
      finally
      {             
         if (bridge != null)
         {
            bridge.stop();
         }       
      }                 
   }
View Full Code Here

    * Send some more messages
    * Verify all messages are received
    */
   public void testCrashAndRestart() throws Exception
   {
         Bridge bridge = null;
         
         try
         {
            final int NUM_MESSAGES = 10;        
           
            bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                                "/ConnectionFactory", "/ConnectionFactory",
                                null, null, null, null,
                                null, 1000, -1, Bridge.QOS_AT_MOST_ONCE,
                                NUM_MESSAGES, -1, null, null, false);
           
            bridge.start();
           
            sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES, true);
                
            checkMessagesReceived(cf1, targetQueue, Bridge.QOS_ONCE_AND_ONLY_ONCE, NUM_MESSAGES, true);
           
            ServerManagement.kill(1);
           
           
            // >30 sec (timeout on remoting)
            Thread.sleep(35000);
           
            ServerManagement.start(1, "all", false);
            ServerManagement.deployQueue("targetQueue", 1);    
           
            setUpAdministeredObjects();
           
            sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES, true);
            
            checkMessagesReceived(cf1, targetQueue, Bridge.QOS_AT_MOST_ONCE, NUM_MESSAGES, true);
         }
         finally
         {     
            if (bridge != null)
            {
               try
               {
                  bridge.stop();
               }
               catch (Exception e)
               {
                  log.error("Failed to stop bridge", e);
               }
View Full Code Here

  
   //destination not available when startup
   //https://jira.jboss.org/jira/browse/JBMESSAGING-999
   public void testDestinationNotAvailableWhenBridgeStartup() throws Exception
   {
      Bridge bridge = null;
     
      try
      {  
         //crash the dest server first
        
         log.info("About to crash server");
        
         ServerManagement.kill(1);
        
         bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                             "/ConnectionFactory", "/ConnectionFactory", null, null, null, null,
                             null, 1000, -1, Bridge.QOS_ONCE_AND_ONLY_ONCE, 10, -1, null, null, false);
        
         bridge.start();
        
         //Restart the server
        
         log.info("Restarting server");
        
         ServerManagement.start(1, "all", false);
        
         ServerManagement.deployQueue("targetQueue", 1);
        
         setUpAdministeredObjects();

         //Wait a while before starting up to simulate the dest being down for a while
         log.info("Waiting 5 secs before bringing server back up");
         Thread.sleep(5000);
         log.info("Done wait");
        
         final int NUM_MESSAGES = 10;
        
         //Send some messages
        
         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES, true);        
        
         log.info("Sent messages");
        
         checkMessagesReceived(cf1, targetQueue, Bridge.QOS_ONCE_AND_ONLY_ONCE, NUM_MESSAGES, false);                 
      }
      finally
      {     

         if (bridge != null)
         {
            try
            {
               bridge.stop();
            }
            catch (Exception e)
            {
               log.error("Failed to stop bridge", e);
            }
View Full Code Here

   public void testRetryConnectionOnStartup() throws Exception
   {
      ServerManagement.kill(1);

     
      Bridge bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                          "/ConnectionFactory", "/ConnectionFactory", null, null, null, null,
                          null, 1000, -1, Bridge.QOS_DUPLICATES_OK, 10, -1, null, null, false);
     
      try
      {
         bridge.start();
         assertFalse(bridge.isStarted());
         assertTrue(bridge.isFailed());

         ServerManagement.start(1, "all", false);
         ServerManagement.deployQueue("targetQueue", 1);        
         setUpAdministeredObjects();
        
         Thread.sleep(3000);
        
         assertTrue(bridge.isStarted());
         assertFalse(bridge.isFailed());
      }
      finally
      {
         try
         {
            bridge.stop();
         }
         catch (Exception e)
         {
            log.error("Failed to stop bridge", e);
         }
View Full Code Here

    * Send some more messages
    * Verify all messages are received
    */
   private void testCrashAndReconnectDestBasic(int qosMode, boolean persistent) throws Exception
   {
      Bridge bridge = null;
        
      try
      {  

         bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                             "/ConnectionFactory", "/ConnectionFactory", null, null, null, null,
                             null, 1000, -1, qosMode, 10, -1, null, null, false);
        
         bridge.start();
           
         final int NUM_MESSAGES = 10;
        
         //Send some messages
        
         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2 , persistent);
        
         //Verify none are received
        
         checkEmpty(targetQueue, 1);
        
         //Now crash the dest server
        
         log.info("About to crash server");
        
         ServerManagement.kill(1);
        
         //Wait a while before starting up to simulate the dest being down for a while
         log.info("Waiting 5 secs before bringing server back up");
         Thread.sleep(5000);
         log.info("Done wait");
        
         //Restart the server
        
         log.info("Restarting server");
        
         ServerManagement.start(1, "all", false);
        
         ServerManagement.deployQueue("targetQueue", 1);
        
         setUpAdministeredObjects();
        
         //Send some more messages
        
         log.info("Sending more messages");
        
         sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent);
        
         log.info("Sent messages");
        
         checkMessagesReceived(cf1, targetQueue, qosMode, NUM_MESSAGES, false);                 
      }
      finally
      {     

         if (bridge != null)
         {
            try
            {
               bridge.stop();
            }
            catch (Exception e)
            {
               log.error("Failed to stop bridge", e);
            }
View Full Code Here

    * Send some more messages
    * Verify all messages are received
    */
   private void testCrashAndReconnectDestCrashBeforePrepare(boolean persistent) throws Exception
   {  
      Bridge bridge = null;
           
      try
      {

         bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                             "/ConnectionFactory", "/ConnectionFactory", null, null, null, null,
                             null, 1000, -1, Bridge.QOS_ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false);
        
         bridge.start();
        
         final int NUM_MESSAGES = 10;           
         //Send some messages
        
         this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2, persistent);
                 
         //verify none are received
        
         checkEmpty(targetQueue, 1);
                 
         //Now crash the dest server
        
         log.info("About to crash server");
        
         ServerManagement.kill(1);
        
         //Wait a while before starting up to simulate the dest being down for a while
         log.info("Waiting 5 secs before bringing server back up");
         Thread.sleep(5000);
         log.info("Done wait");
        
         //Restart the server
        
         ServerManagement.start(1, "all", false);
        
         ServerManagement.deployQueue("targetQueue", 1);
        
         setUpAdministeredObjects();
        
         sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent);
                          
         checkMessagesReceived(cf1, targetQueue, Bridge.QOS_ONCE_AND_ONLY_ONCE, NUM_MESSAGES, false);        
      }
      finally
      {     
                
         if (bridge != null)
         {
            try
            {
               bridge.stop();
            }
            catch (Exception e)
            {
               log.error("Failed to stop bridge", e);
            }
View Full Code Here

    * Send some 15 messages, not in multiple by BatchSize (10).
    * Verify all messages are received
    */
   private void testCrashOnStartupAndReconnectWithBatchTime(int qosMode, boolean persistence) throws Exception
   {
      Bridge bridge = null;
        
      try
      {  

         bridge = new Bridge(false, sourceProps, targetProps, "/queue/sourceQueue", "/queue/targetQueue",
                             "/ConnectionFactory", "/ConnectionFactory", null, null, null, null,
                             null, 1000, -1, qosMode, 10, 5000, null, null, false);
        
         //Now crash the dest server
        
         log.info("About to crash server");
        
         ServerManagement.kill(1);

         bridge.start();
           
         //Wait a while before starting up to simulate the dest being down for a while
         log.info("Waiting 5 secs before bringing server back up");
         Thread.sleep(4000);
         log.info("Done wait");

         //Restart the server
        
         log.info("Restarting server");
        
         ServerManagement.start(1, "all", false);
        
         ServerManagement.deployQueue("targetQueue", 1);
        
         setUpAdministeredObjects();

         final int NUM_MESSAGES = 15;
        
         //Send some messages
        
         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES , persistence);
                 
         //Wait for batch time checker to start working
         Thread.sleep(7000);
        
         checkMessagesReceived(cf1, targetQueue, qosMode, NUM_MESSAGES, false);
        
      }
      finally
      {     

         if (bridge != null)
         {
            try
            {
               bridge.stop();
            }
            catch (Exception e)
            {
               log.error("Failed to stop bridge", e);
            }
View Full Code Here

TOP

Related Classes of org.jboss.jms.server.bridge.Bridge$SourceListener

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.