About me
  • 19🐱🐱 Crazy Cat Lady
  • Free and Open Source Advocate
  • 2008 Computer Science Graduate (Software Engineer)
  • 2009 Dijkstra A* Witch
  • 2012 Metadata Wrangler
  • 2013 OSGeo Charter Member
  • 2017-2019 OSGeo President
  • 2016 Women in Tech
  • Senior Software Engineer at RedHat
  • 2019 Integration Druid
  • 2020 Apache Software Foundation

Camel Quarkus

Camel K

Kamelets

Coding time


                from("timer:java?period=1000")
                  .setBody()
                    .simple("Hello World!")
                  .to("log:info");
            

<?xml version="1.0" encoding="UTF-8"?>
<!-- camel-k: language=xml -->

<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://camel.apache.org/schema/spring"
        xsi:schemaLocation="
            http://camel.apache.org/schema/spring
            http://camel.apache.org/schema/spring/camel-spring.xsd">

	<!-- Write your routes here, for example: -->
    <route id="xml">
        <from uri="timer:xml?period=1000"/>
        <setBody>
            <simple>Hello Camel K from ${routeId}</simple>
        </setBody>
        <to uri="log:info"/>
    </route>
</routes>
            

          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");
            }
          }
            

            # camel-k: language=yaml

            # Write your routes here, for example:
            - from:
                uri: "timer:yaml"
                parameters:
                  period: "1000"
                steps:
                  - set-body:
                      constant: "Hello Camel K from yaml"
                  - to: "log:info"
            

Coding time


                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());
                    }

                  };

            

Coding time


   Exchange[
         ExchangePattern: InOnly, 
         BodyType: String, 
         Body: 
            {"coord":
              {"lon":-5.9761,"lat":37.3824},
              "weather":[
                {
                  "id":804,
                  "main":"Clouds",
                  "description":"overcast clouds",
                  "icon":"04d"
                }],
              "base":"stations",
              "main":
                {
                  "temp":293.64,
                  "feels_like":293.68,
                  "temp_min":292.59,
                  "temp_max":294.26,
                  "pressure":1003,
                  "humidity":74
                },
              "visibility":7150,
              "wind":{"speed":3.13,"deg":225,"gust":8.49},
              "clouds":{"all":100},
              "dt":1619448268,
              "sys":{"type":3,"id":2011488,"country":"ES","sunrise":1619415275,"sunset":1619464109},
              "timezone":7200,"id":2510911,"name":"Seville","cod":200}
   ]


            

from("timer:weathertest")
      .to("weather:foo?location=Sevilla,Spain&appid={{TOKEN}}&geolocationAccessKey={{TOKEN}}")
      .to("log:info");
            

Coding time


                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}}");
            

Coding time


                from("telegram:bots?authorizationToken={{TELEGRAM_BOT_TOKEN}}")
                   .to("weather:foo?location=Sevilla,Spain&appid={{TOKEN}}&geolocationAccessKey={{TOKEN}}")
                  .to("telegram:bots?authorizationToken={{TELEGRAM_BOT_TOKEN}}");