|
Akka/Scala example source code file (Consumer4.java)
The Consumer4.java Akka example source codepackage docs.camel; //#Consumer4 import akka.camel.CamelMessage; import akka.camel.javaapi.UntypedConsumerActor; import scala.concurrent.duration.Duration; import scala.concurrent.duration.FiniteDuration; import java.util.concurrent.TimeUnit; public class Consumer4 extends UntypedConsumerActor { private final static FiniteDuration timeout = Duration.create(500, TimeUnit.MILLISECONDS); @Override public FiniteDuration replyTimeout() { return timeout; } public String getEndpointUri() { return "jetty:http://localhost:8877/camel/default"; } public void onReceive(Object message) { if (message instanceof CamelMessage) { CamelMessage camelMessage = (CamelMessage) message; String body = camelMessage.getBodyAs(String.class, getCamelContext()); getSender().tell(String.format("Hello %s",body), getSelf()); } else unhandled(message); } } //#Consumer4 Other Akka source code examplesHere is a short list of links related to this Akka Consumer4.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.