Search in sources :

Example 1 with Routee

use of com.nr.instrumentation.akka22.test.actors.routing.Routee in project newrelic-java-agent by newrelic.

the class AkkaTest method testRoutedActorToRouteeSend.

@Test
public void testRoutedActorToRouteeSend() throws InterruptedException {
    ActorSystem system = ActorSystem.create("AkkaTestSystem");
    TestApp.sendRoutedMessageToRouteeInTransaction(system);
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    int finishedTransactionCount = introspector.getFinishedTransactionCount(5000);
    assertEquals(1, finishedTransactionCount);
    String transactionName = "OtherTransaction/Akka/Routee";
    Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(transactionName);
    assertTrue(metricsForTransaction.containsKey("Akka/receive/" + RoutingActor.class.getName()));
    assertTrue(metricsForTransaction.containsKey("Akka/receive/" + Routee.class.getName()));
}
Also used : ActorSystem(akka.actor.ActorSystem) TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Routee(com.nr.instrumentation.akka22.test.actors.routing.Routee) RoutingActor(com.nr.instrumentation.akka22.test.actors.routing.RoutingActor) Test(org.junit.Test)

Example 2 with Routee

use of com.nr.instrumentation.akka22.test.actors.routing.Routee in project newrelic-java-agent by newrelic.

the class TestApp method sendRoutedMessageToRouteeInTransaction.

@Trace(dispatcher = true)
public static void sendRoutedMessageToRouteeInTransaction(ActorSystem system) throws InterruptedException {
    final ActorRef routee = system.actorOf(Props.create(Routee.class));
    ActorRef router = system.actorOf(new RoundRobinPool(5).props(Props.create(RoutingActor.class, routee)));
    // Let system initialize
    Thread.sleep(2000);
    router.tell("routing", null);
    // Let message processing finish
    Thread.sleep(2000);
}
Also used : ActorRef(akka.actor.ActorRef) RoundRobinPool(akka.routing.RoundRobinPool) Routee(com.nr.instrumentation.akka22.test.actors.routing.Routee) Trace(com.newrelic.api.agent.Trace)

Aggregations

Routee (com.nr.instrumentation.akka22.test.actors.routing.Routee)2 ActorRef (akka.actor.ActorRef)1 ActorSystem (akka.actor.ActorSystem)1 RoundRobinPool (akka.routing.RoundRobinPool)1 Introspector (com.newrelic.agent.introspec.Introspector)1 TracedMetricData (com.newrelic.agent.introspec.TracedMetricData)1 Trace (com.newrelic.api.agent.Trace)1 RoutingActor (com.nr.instrumentation.akka22.test.actors.routing.RoutingActor)1 Test (org.junit.Test)1