Camel Quarkus
Camel K
Kamelets
from("timer:java?period=1000")
.setBody()
.simple("Hello World!")
.to("log:info");
import java.util.Random;
import org.apache.camel.builder.RouteBuilder;
public class HelloWorld extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:java?period=1000")
.setBody()
.simple("Hello World!")
.to("log:info");
}
}
from("timer:java?period=1000")
//.setBody()
// .simple("Hello World!")
// Generate random name
.process(processor)
.to("log:info");
Processor processor = new Processor() {
String[] firstname = new String[] { "Aleja", "Almerinda", "Ambrosia", "Benilda",
"Bercia", "Cayetana", "Ermisinda", "Escolástica", "Esmaragda", "Esmerencia"};
String[] lastname = new String[] {"Zuzunaga", "Sorní", "Sandemetrio", "Bonachera",
"Sazón", "Piesplanos", "Parraverde", "Alcoholado" };
Random r = new Random();
@Override
public void process(Exchange exchange) throws Exception {
StringBuilder name = new StringBuilder();
name.append(firstname[r.nextInt(firstname.length)]);
name.append(" ");
name.append(lastname[r.nextInt(lastname.length)]);
exchange.getMessage().setBody(name.toString());
}
};
public class ChatBotLogic {
public String chatBotProcess(String message) {
if( "do-not-reply".equals(message) ) {
return null; // no response in the chat
}
return "Received " + message;
}
}
from("telegram:bots?authorizationToken={{TELEGRAM_BOT_TOKEN}}")
.bean(ChatBotLogic.class)
.to("telegram:bots?authorizationToken={{TELEGRAM_BOT_TOKEN}}");
You can find more on
This presentation is on