review of docs processed

This commit is contained in:
RayRoestenburg 2012-07-23 01:36:12 +02:00
parent 9ac24ee4d7
commit 6c43fb4235
11 changed files with 94 additions and 145 deletions

View file

@ -1,14 +1,17 @@
package docs.camel;
//#CamelActivation
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.camel.Camel;
import akka.camel.CamelExtension;
import akka.camel.javaapi.UntypedConsumerActor;
import akka.dispatch.Future;
import akka.util.Duration;
import akka.util.FiniteDuration;
import static java.util.concurrent.TimeUnit.SECONDS;
//#CamelActivation
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.camel.Camel;
import akka.camel.CamelExtension;
import akka.camel.javaapi.UntypedConsumerActor;
import akka.dispatch.Future;
import akka.util.Duration;
import akka.util.FiniteDuration;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
@ -18,17 +21,20 @@ public class ActivationTestBase {
@Test
public void testActivation() {
//#CamelActivation
// ..
ActorSystem system = ActorSystem.create("some-system");
Props props = new Props(MyConsumer.class);
ActorRef producer = system.actorOf(props,"myproducer");
Camel camel = CamelExtension.get(system);
// get a future reference to the activation of the endpoint of the Consumer Actor
FiniteDuration duration = Duration.create(10, TimeUnit.SECONDS);
FiniteDuration duration = Duration.create(10, SECONDS);
Future<ActorRef> activationFuture = camel.activationFutureFor(producer, duration);
// or, block wait on the activation
camel.awaitActivation(producer, duration);
//#CamelActivation
//#CamelDeactivation
// ..
system.stop(producer);
// get a future reference to the deactivation of the endpoint of the Consumer Actor
Future<ActorRef> deactivationFuture = camel.activationFutureFor(producer, duration);