Package com.nokia.dempsy.messagetransport

Examples of com.nokia.dempsy.messagetransport.Destination


   public void testBlockingQueueUsingDestination() throws Exception
   {
      try
      {
         setUp2("/blockingqueueTest2AppContext.xml");
         Destination destination = destinationFactory.getDestination();
         Sender lsender = senderFactory.getSender(destination);
         lsender.send("Hello".getBytes());
         String message = new String( pojo.getMessage() );
         assertEquals("Hello", message);
         assertEquals(0, overflowHandler.overflowCalled);
View Full Code Here


      runAllCombinations(new Checker()
      {
         @Override
         public void check(int port, boolean localhost, long batchOutgoingMessagesDelayMillis) throws Throwable
         {
            final StatsCollector statsCollector = new StatsCollectorFactoryCoda().createStatsCollector(new ClusterId("test", "test-cluster"), new Destination(){});

            SenderFactory factory = null;
            TcpReceiver adaptor = null;
            try
            {
              
               boolean shouldBatch = batchOutgoingMessagesDelayMillis >= 0;
              
               if (shouldBatch)
                  batchedAtLeastOnce.set(true);
              
               TcpTransport transport = new TcpTransport();
               transport.setFailFast(getFailFast());

               // by default batching isn't disabled.
               assertFalse(transport.isBatchingDisabled());
              
               if (!shouldBatch)
                  transport.setDisableBatching(true);
              
               if (!shouldBatch)
                  assertTrue(transport.isBatchingDisabled());
              
               assertEquals(!shouldBatch, transport.isBatchingDisabled());
              
               //===========================================
               // setup the sender and receiver
               adaptor = (TcpReceiver)transport.createInbound(null);
               adaptor.setStatsCollector(statsCollector);
               StringListener receiver = new StringListener();
               adaptor.setListener(receiver);

               factory = transport.createOutbound(null, statsCollector);
               if (port > 0) adaptor.setPort(port);
               if (localhost) adaptor.setUseLocalhost(localhost);
               //===========================================

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               byte[] messageBytes = "Hello".getBytes();
               Sender sender = factory.getSender(destination);
              
View Full Code Here

               if (port > 0) adaptor.setPort(port);
               if (localhost) adaptor.setUseLocalhost(localhost);
               //===========================================

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
               sender.send("Hello".getBytes());
              
View Full Code Here

      runAllCombinations(new Checker()
      {
         @Override
         public void check(int port, boolean localhost, long batchOutgoingMessagesDelayMillis) throws Throwable
         {
            final StatsCollector statsCollector = new StatsCollectorFactoryCoda().createStatsCollector(new ClusterId("test", "test-cluster"), new Destination(){});

            // we're going to batch no matter what the parameter says.
            // We want the batching timeout to be really small
            batchOutgoingMessagesDelayMillis = 175;
           
            SenderFactory factory = null;
            TcpReceiver adaptor = null;
           
            try
            {
               //===========================================
               // setup the sender and receiver
               adaptor = new TcpReceiver(null,getFailFast());
               adaptor.setStatsCollector(statsCollector);
               StringListener receiver = new StringListener();
               adaptor.setListener(receiver);
              
               // we want to keep track of the number of bytes written
               final long[] flushByteCounts = new long[4]; //
                    
               factory = makeSenderFactory(new BatchingOutputStreamWatcher(flushByteCounts),
                     statsCollector,batchOutgoingMessagesDelayMillis);

               if (port > 0) adaptor.setPort(port);
               if (localhost) adaptor.setUseLocalhost(localhost);
               //===========================================

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
              
               // send messageBytes
View Full Code Here

      runAllCombinations(new Checker()
      {
         @Override
         public void check(int port, boolean localhost, long batchOutgoingMessagesDelayMillis) throws Throwable
         {
            final StatsCollector statsCollector = new StatsCollectorFactoryCoda().createStatsCollector(new ClusterId("test", "test-cluster"), new Destination(){});

            // we're going to batch no matter what the parameter says.
            batchOutgoingMessagesDelayMillis = 10000;
           
            SenderFactory factory = null;
            TcpReceiver adaptor = null;
           
            try
            {
               //===========================================
               // setup the sender and receiver
               adaptor = new TcpReceiver(null,getFailFast());
               adaptor.setStatsCollector(statsCollector);
               StringListener receiver = new StringListener();
               adaptor.setListener(receiver);
              
               // we want to keep track of the number of bytes written
               final long[] flushByteCounts = new long[2]; // This should be all that's needed
                    
               factory = makeSenderFactory(new BatchingOutputStreamWatcher(flushByteCounts),
                     statsCollector,batchOutgoingMessagesDelayMillis);

               if (port > 0) adaptor.setPort(port);
               if (localhost) adaptor.setUseLocalhost(localhost);
               //===========================================

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
              
               int mtu = ((TcpSender)sender).getMtu();
View Full Code Here

      runAllCombinations(new Checker()
      {
         @Override
         public void check(int port, boolean localhost, long batchOutgoingMessagesDelayMillis) throws Throwable
         {
            final StatsCollector statsCollector = new StatsCollectorFactoryCoda().createStatsCollector(new ClusterId("test", "test-cluster"), new Destination(){});

            // we're going to batch no matter what the parameter says.
            batchOutgoingMessagesDelayMillis = 10000;
           
            SenderFactory factory = null;
            TcpReceiver adaptor = null;
            TcpReceiver adaptor2 = null;
           
            try
            {
               //===========================================
               // setup the sender and receiver
               adaptor = new TcpReceiver(null,getFailFast());
               adaptor2 = new TcpReceiver(null,getFailFast());
               adaptor.setStatsCollector(statsCollector);
               StringListener receiver = new StringListener();
               adaptor.setListener(receiver);
              
               // we want to keep track of the number of bytes written
               final long[] flushByteCounts = new long[2]; // This should be all that's needed
                    
               factory = makeSenderFactory(new BatchingOutputStreamWatcher(flushByteCounts),
                     statsCollector,batchOutgoingMessagesDelayMillis);

               if (port > 0) adaptor.setPort(port);
               if (localhost) adaptor.setUseLocalhost(localhost);
               //===========================================

               adaptor.start(); // start the adaptor
               Destination destination = adaptor.getDestination(); // get the destination
               Destination destination2 = adaptor2.getDestination(); // get the destination

               // send a message
               Sender sender = factory.getSender(destination);
               factory.getSender(destination2)// create a second sender to make sure the historgram acts correctly
              
View Full Code Here

      ClusterId clusterId = new ClusterId("app","cluster");
      MetricName name = strategy.createName(clusterId, "metric");

      assertEquals("metric", name.getName());
      assertEquals("app-cluster", name.getGroup());
      assertTrue(strategy.buildPrefix(clusterId, new Destination() { @Override public String toString() { return "destination"; } }).startsWith("Hello."));

      // make sure setting the environment prefix doesn't effect the -D option
      statsCollectorFactory.setEnvironmentPrefix("otherEnvPrefix");
      assertTrue(strategy.buildPrefix(clusterId, new Destination() { @Override public String toString() { return "destination"; } }).startsWith("Hello."));

      // make sure that without the system property the setEnvironmentPrefix value works
      System.getProperties().remove(StatsCollectorFactoryCoda.environmentPrefixSystemPropertyName);
      assertTrue(strategy.buildPrefix(clusterId, new Destination() { @Override public String toString() { return "destination"; } }).startsWith("otherEnvPrefix"));

      // make sure that delting the environmentPrefix doesn't create an issue.
      statsCollectorFactory.setEnvironmentPrefix(null);
      strategy.buildPrefix(clusterId, new Destination() { @Override public String toString() { return "destination"; } }).startsWith("otherEnvPrefix");
   }
View Full Code Here

   {
      onodes = System.setProperty("min_nodes_for_cluster", "1");
      oslots = System.setProperty("total_slots_for_cluster", "20");

      final ClusterId clusterId = new ClusterId("test", "test-slot");
      Destination destination = new Destination() {};
      ApplicationDefinition app = new ApplicationDefinition(clusterId.getApplicationName());
      DecentralizedRoutingStrategy strategy = new DecentralizedRoutingStrategy(1, 1);
      app.setRoutingStrategy(strategy);
      app.setSerializer(new JavaSerializer<Object>());
      ClusterDefinition cd = new ClusterDefinition(clusterId.getMpClusterName());
View Full Code Here

TOP

Related Classes of com.nokia.dempsy.messagetransport.Destination

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.