Package org.asmatron.messengine.engines

Examples of org.asmatron.messengine.engines.DefaultMessagingDelegate.send()


        lock.release();
      }
    };
    final String type = "test";
    engine.addMessageListener(type, listener);
    engine.send(new TestMessage<String>(type, expectedBody));
    lock.tryAcquire(3, TimeUnit.SECONDS);
    assertEquals(expectedBody, actualBody.toString());
    engine.stop();
  }
View Full Code Here


    final String type = "foo";
    Message<String> message = new TestMessage<String>(type, expectedBody);
    engine.addMessageListener(type, listener);
    final int totalMessages = 1000;
    for (int i = 0; i < totalMessages; i++) {
      engine.send(message);
    }
    lock.tryAcquire(totalMessages, 3, TimeUnit.SECONDS);
    assertEquals(totalMessages, counter.get());
    engine.stop();
  }
View Full Code Here

    Message<String> message = new TestMessage<String>(type, expectedBody);
    engine.addMessageListener(type, listenerA);
    engine.addMessageListener(type, listenerB);
    final int totalMessages = 1000;
    for (int i = 0; i < totalMessages; i++) {
      engine.send(message);
    }
    lock.tryAcquire(totalMessages * 2, 3, TimeUnit.SECONDS);
    assertEquals(totalMessages * 2, counter.get());
    engine.stop();
  }
View Full Code Here

        counter.incrementAndGet();
      }
    };
    String type = "foo";
    engine.addMessageListener(type, listener);
    engine.send(new TestMessage<String>(type, "body"));
    Thread.sleep(100);
    engine.removeMessageListener(type, listener);
    engine.send(new TestMessage<String>(type, "body"));
    Thread.sleep(100);
    assertEquals(1, counter.get());
View Full Code Here

    String type = "foo";
    engine.addMessageListener(type, listener);
    engine.send(new TestMessage<String>(type, "body"));
    Thread.sleep(100);
    engine.removeMessageListener(type, listener);
    engine.send(new TestMessage<String>(type, "body"));
    Thread.sleep(100);
    assertEquals(1, counter.get());
    engine.stop();
  }
View Full Code Here

      public void run() {
        try {
          Thread.sleep(responseDelay);
        } catch (InterruptedException e) {
        }
        engine.send(expectedResponse);
      }
    });
    long startTime = System.currentTimeMillis();

    Future<Message<?>> future = engine.request(new TestMessage<String>("requestType", "requestBody"), responseType,
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.