remove all but one occurrence of single-arg tell()

This commit is contained in:
Roland 2012-09-19 23:55:53 +02:00
parent 2502919c6e
commit ce49ffe3c6
71 changed files with 550 additions and 538 deletions

View file

@ -14,8 +14,6 @@ package docs.camel;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
public class ActivationTestBase {
@Test

View file

@ -12,7 +12,7 @@ public class Consumer2 extends UntypedConsumerActor {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
String body = camelMessage.getBodyAs(String.class, getCamelContext());
getSender().tell(String.format("Received message: %s",body));
getSender().tell(String.format("Received message: %s",body), getSelf());
} else
unhandled(message);
}

View file

@ -18,12 +18,12 @@ public class Consumer3 extends UntypedConsumerActor{
public void onReceive(Object message) {
if (message instanceof CamelMessage) {
getSender().tell(Ack.getInstance());
getSender().tell(Ack.getInstance(), getSelf());
// on success
// ..
Exception someException = new Exception("e1");
// on failure
getSender().tell(new Status.Failure(someException));
getSender().tell(new Status.Failure(someException), getSelf());
} else
unhandled(message);
}

View file

@ -23,7 +23,7 @@ public class Consumer4 extends UntypedConsumerActor {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
String body = camelMessage.getBodyAs(String.class, getCamelContext());
getSender().tell(String.format("Hello %s",body));
getSender().tell(String.format("Hello %s",body), getSelf());
} else
unhandled(message);
}

View file

@ -36,7 +36,7 @@ public class ErrorThrowingConsumer extends UntypedConsumerActor{
@Override
public void preRestart(Throwable reason, Option<Object> message) {
getSender().tell(new Status.Failure(reason));
getSender().tell(new Status.Failure(reason), getSelf());
}
}
//#ErrorThrowingConsumer

View file

@ -1,7 +1,6 @@
package docs.camel;
import akka.actor.*;
import org.junit.Test;
public class OnRouteResponseTestBase {
@ -18,7 +17,7 @@ public class OnRouteResponseTestBase {
ActorRef forwardResponse = system.actorOf(new Props(factory));
// the Forwarder sends out a request to the web page and forwards the response to
// the ResponseReceiver
forwardResponse.tell("some request");
forwardResponse.tell("some request", null);
//#RouteResponse
system.stop(receiver);
system.stop(forwardResponse);

View file

@ -1,20 +1,14 @@
package docs.camel;
import akka.actor.*;
import akka.camel.Camel;
import akka.camel.CamelExtension;
import akka.camel.CamelMessage;
import akka.pattern.Patterns;
import scala.concurrent.Future;
import scala.concurrent.util.Duration;
import scala.concurrent.util.FiniteDuration;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import scala.concurrent.Future;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.camel.CamelMessage;
import akka.pattern.Patterns;
public class ProducerTestBase {
public void tellJmsProducer() {
@ -22,7 +16,7 @@ public class ProducerTestBase {
ActorSystem system = ActorSystem.create("some-system");
Props props = new Props(Orders.class);
ActorRef producer = system.actorOf(props, "jmsproducer");
producer.tell("<order amount=\"100\" currency=\"PLN\" itemId=\"12345\"/>");
producer.tell("<order amount=\"100\" currency=\"PLN\" itemId=\"12345\"/>", null);
//#TellProducer
system.shutdown();
}
@ -45,7 +39,7 @@ public class ProducerTestBase {
ActorRef producer = system.actorOf(props,"jmsproducer");
Map<String,Object> headers = new HashMap<String, Object>();
headers.put(CamelMessage.MessageExchangeId(),"123");
producer.tell(new CamelMessage("<order amount=\"100\" currency=\"PLN\" itemId=\"12345\"/>",headers));
producer.tell(new CamelMessage("<order amount=\"100\" currency=\"PLN\" itemId=\"12345\"/>",headers), null);
//#Correlate
system.stop(producer);
system.shutdown();

View file

@ -9,7 +9,7 @@ public class RequestBodyActor extends UntypedActor {
public void onReceive(Object message) {
Camel camel = CamelExtension.get(getContext().system());
ProducerTemplate template = camel.template();
getSender().tell(template.requestBody("direct:news", message));
getSender().tell(template.requestBody("direct:news", message), getSelf());
}
}
//#RequestProducerTemplate

View file

@ -9,7 +9,7 @@ public class Responder extends UntypedActor{
public void onReceive(Object message) {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
getSender().tell(createResponse(camelMessage));
getSender().tell(createResponse(camelMessage), getSelf());
} else
unhandled(message);
}

View file

@ -16,9 +16,9 @@ public class HttpTransformer extends UntypedActor{
return text.replaceAll("Akka ", "AKKA ");
}
});
getSender().tell(replacedMessage);
getSender().tell(replacedMessage, getSelf());
} else if (message instanceof Status.Failure) {
getSender().tell(message);
getSender().tell(message, getSelf());
} else
unhandled(message);
}