 Well, hello and welcome to another Dev Nation. We have another exciting live broadcast today We're gonna be talking about Apache Camel, right? So Apache Camel. Hopefully you've heard of that project before It's all about integration patterns, but more importantly what we're gonna have today is working within the context of Kubernetes So that's where you get a chance to see something very cool. So up next is Nicola He's one of the key contributors to Apache Camel and specifically the Apache Camel K project Nicola. You're up next We'll start the presentation Hope you can see the screen Okay, so This is these are the topics that we are going to cover today So first I will give you an introduction about Apache Camel That is the base project that we work on and for those of you that then don't know anything about Camel Then we'll talk about these awesome project Camel K will show you a cool demo That will talk about the relationship between Camel K and Knet even then with Quarkus and what's next in the broad map of Camel K. But first of all, let me introduce myself I'm Nicola Ferraro working as software engineer for Redat Later Luca Burgazoli will join me doing the second part of the presentation with both work together on Apache Camel Camel K and synthesis and a lot of other open source project, but today we are going to talk about Apache Camel and Camel K so What is Apache Camel? Apache Camel is The most complete open source integration framework. It's the Swiss knife of integration It has more than ten years of development But it is one of the most active Apache project because it gets a lot of contributors every month So it's based on enterprise integration patterns It supports more than 300 components using a powerful DSL But before talking about what integration framework is let's talk about Integration so what we mean by integration Whenever you have two systems system A and system B in the picture that have to communicate But they were not the science to work together. You have an integration problem Usually system use different transport to one may use web services. They only use rest services One may use a synchronous communication The other one may be synchronous using Kafka or active NQ or whatever but even if they use the same transport today for sure have different domain models So you have to map between object of system A and system B and back and do other calls So when they when integrate the systems, but Camel is all about all that Camel is the glue between this parade system Camel can help integrating system whatever they use to communicate and It helps you because it's an integration framework. It's a toolbox So a set of tools that you can pick and use so to solve your integration problem And what are these tools one of the most important tools that Camel provide is this Enterprise integration pattern. This is a book from 15 years ago written by Gregor Hope and Bobby Huth and It is still actual because integration problem are still the same there We have added the more problems probably recently, but they are still actual They describe problems and solution recurring problem and solution when you have to integrate system For example, this is the list of some of the integration patterns present in the book content based routing routing messages based on their content and Splitting messaging them re-aggregating them fixing out-of-order messages and reaching the content of some messages and Other other patterns that are present in the book Camel was originally based on this book And it contains almost all the patterns that were present in the book But not only them because a lot of people contributed over the year a lot of other patterns For example, you can find in Camel or it's the saga pattern for achieving consistency Microservice architecture or even the circuit breaker pattern and for avoiding cascading failure when you integrate systems So a lot of other pattern have been added. Where do you use this pattern? So the basic building block of Camel is the Camel route when you write Camel you've write Camel DSL in Java or XML here We have two examples, but we have also other languages can use other languages The XML is important because there are some visual tool that helps you To design routes graphically, but let's focus on this Java DSL So a route start from an endpoint in this case We have the file endpoint here and then in one or more other endpoints in this case We have the JMS endpoint. So these two lines of Java code means hey Camel Take all the data all the files that are present in the data inbox of my hard drive then for each file Transform it into a JMS message and send it to the queue name at order So with these two line of file you do a lot of things already and Camel also marked the file That's completed for you and manage the errors for you with just these two lines of code But you can also use enterprise integration pattern when you design routes in Camel So for example, let's start from the file endpoint and then take all the files in the inbox directory then split The file so we'll take each a single line of the file Then we transform each line to XML message for example You can use JSON or whatever and then send it to an active and queue destination or you can use Kafka So Camel is based on this concept of endpoint and you have a lot of components Corresponding to these endpoints and when I say a lot, I see I say I mean a lot So this is the full list of components back to I think one week ago because last week We have added the other two components probably so you can find whatever there is to keep our elastic search MongoDB Cassandra, you can connect to Facebook to Twitter to Telegram to Slack you to a JDBC endpoint you can use GRPC HL7 and so whatever you need it's here Camel can connect to anything thanks to the components It is the major power of Camel So to look up Camel is made of routes so the power for DSL where you can write routes using enterprise integration patterns and it does it provides a lot of components to connect to anything This is Apache Camel the most complete integration framework and Camel can run on popular runtimes like Spring Boot, Carath, Wildfly, even Torn Tail, any micro-profile server or Parkus Luca will talk about Parkus later It runs as a library you can put camel routes inside your application when you when you write your application But this is not the only way to run Camel because today We are talking about another way to run Camel DSL in the cloud and we are talking about Camel K So Camel K is a new project that we have started last year at the end of August after the summer holidays and It is about running integrations in the cloud running Camel DSL in the cloud when I say cloud I mean Kubernetes or OpenShift It's written in Go. Apache Camel is written in In Java Apache Camel K is an operator written in Go that runs Camel in the cloud and It's a very it's a subproject of Apache Camel It's available on github.com Apache Camel dash K So look at the code and download it from the repository if you want to use it. There are some releases there So this is what Camel K is about So we've noticed that there are a lot of use cases where people don't want to To deal with run times like spring boot and don't tell they just want to integrate system and What they have to do if they want to integrate system is to write the camel DSL So the camel DSL is complete It's anything you need to do to integrate system and they then with Camel K They can write the integration DSL in a file in a simple file You can use Java, but you can use also a groovy script a Kotlin script You can use also JavaScript if you want and you can use also the XML provided by the visual tool So once you've read this file Camel K is made of a client tool called Camel with the K at the beginning Camel So you've run you take this file Camel run Integration dot groovy and your integration runs in the cloud So you don't have to deal with containers of building containers and doing the deployment of Kubernetes or OpenShift That is just an enhanced version of Kubernetes. Nothing more So you just it just runs in the cloud So this is the high high level architecture Camel K. You have your development environment where you've write your integration code You can have also Other completion and suggestion from from the plug-in With the camel CLI tool you type camel run integration and then the camel CLI to take your Integration code wraps it into a custom resource in Kubernetes and upload it to the remote cloud Custom resources in Kubernetes are a way to extend Kubernetes functionalities by adding something more and we have added an integration Custom resource to Kubernetes and other customs up custom resources that need the camel K needs to for it to work a Custom resource is usually managed by an operator and we provide a camel K operator So the camel K operator takes this custom resource and convert it into running containers and running deployments. So It does it in a really really really really really quickly So this is the loop you change your integration code the integration code is synchronized Remotely into the remote cloud and then the camel K operator immediately Change the deployment in less than one second. You have a redeployment of your application But I don't know if you believe me or not. I will show you a simple demo so I'm going to build with camel K a chatbot So if you have telegram on your phone and the QR code reader actually don't need the QR code reader Just use your camera if you have an iPhone you can use it later after I build it. So let's write some Some code together. So I've installed the mini shift in my machine mini shift is a Nephite version of open shift with all the functionality of the real version But it runs locally you can install it really easily and then I prepared it here a file It's an empty Java file. I'm going to write some code so to integrate a to provide to build this chatbot So let's start writing some camel DSL Let's start from the telegram and point that this reason point The plug-in suggests that I have to provide an authorization token to talk with the both So here I'm using using a property place older In state of law of the real token and then I log every message The body of every message that is sent to the both of these that first integration that I want to run What can I do to run it or in this? Mini shift the namespace open ship namespace camel K operator is already installed But I can type camel install to install it. It's really easy to use So now I just take the authorization token of the bot and then what they do is camel run the name of the file Routes of Java in a speed token equals to This token and I'm using that mode as soon as I press enter You will see here that a pod is already running Promotely so you see here that there is a local process, but it's not the local process It's a remote process. So this integration is running in the cloud What you see here is the streaming of the logs that come from the cloud back to my machine So you see here live what's happening there in the cloud. Let's do a rolling deployment. For example now I just want to avoid that you push messages this spot because the bot is public and then I filter this in a simple expression So I'm just telling camel. Hey, I just want to to see messages sent by myself This is my ID on telegram Then I save and you see here a rolling deployment that immediately deploy another version of the application with this So let's start communicating with the bot. You see yes and start is the telegram chat. Hey Then you see the message is deep here so Let's do something more complex Just convert the body to string. It means using the camel auto conversion feature to just take the content of the message Not the body and the the the the from and they are the etc. So then show it to a choice. We Are doing content base routing in this case. So when the content of the message In this case of the body To lower case I don't know you don't know become of yourself, but just follow me. It's really easy to understand when the body to lower case You can use Java methods contains the world Chuck and Now some of you may already understand where I am going If it contains Chuck, I will do something. Otherwise, it's really natural. I Discard this message So what have we are going to do if the message contains Chuck? So we are going to consume an external API So this is a nice API that I found on internet, but I'm not responsible for what it returns We can contact it using the HTTP endpoint, but since it's deprecated and using the HTTP for camel endpoint It's ICNDB.com ICNDB probably, you know more IMDB.com the internet movie database Well, ICNDB.com is the internet Chuck Norris database So it is a nice API that returns some random jokes about Chuck Norris So let's do something with it. So let's for now Just print the body that is returned there. So crawling deployment in the cloud streaming of the logs Hey, you see that hey is discarded, but if I write Chuck now, I Get some messages from that API. I don't know if you can see it, but I read it for you It's a JSON data JSON data with a type and a value property and then the sub object. It contains A joke. I don't want to to to read them, but I will read some of them, but you will use it later, probably And so it's JSON data. What we do with JSON data in camel. We can un-martial that so using for example the Jackson library and Then we want to transform the body because we don't need the full JSON data We just want to focus on what on the body property called value and then the sub property called joke So let's save rolling deployment Let's try again back and Then we have only the sentence So Chuck Norris you can access the DB from the UI a lot of sentences like that And then the last thing that we have to do to complete the chatbot is to send back this data to the telegram chat No, so to just use the telegram. Sorry the telegram and phone. So save rolling deployment and then I write Chuck here and then I have a sentence about Chuck Norris Anytime I do it. So Chuck Norris can unit test entire applications with a single assert That's what that's really cool. So now I let you use it. I remove the filter because now only me can use it Now it's deployed No, I have done. I don't know 10 rolling deployment of the application while I developed it in few minutes This is the power of camel K. There is a video also recorded here What I've just done in live coding and you can use it Let's go back to the presentation if you can scan this code and use the boat or just contact camel K But and now I'll tell you why I choose this demo because it's it's it's an example of Integration where you have two systems. No, you have from one side the telegram system from the other side the Internet Chuck Norris database that they were not originally created to work together in any way But at some point this is the developer life that there is some business people that entered the room and say hey We have to connect these two systems How can you do? You can change one of the two systems to talk with the other but you reason the risk is to couple them For example in this case, you cannot change not telegram. No to the Internet Chuck Norris database So the best solution is always to put something in the middle like camel so the glue that connects the two systems because camel can talk with each system and If you want to integrate system, there are usually hidden hidden issues that we have to solve for example What if the Chuck Norris at the base becomes low? We can stop calling it and return some vacant response to the user like Chuck Norris will kick your back shortly Something like that or if telegram is not reach about some point We can try sending the message at about the three seconds. These two things are one liners in camel So look at the gold you will see that they are really really easy to implement So but now we are going to talk about another topic and it's camel K and K native so Camel K loves K native. I don't want to go much into detail about what K native is but Tell you that K native is a series of building blocks for adding several as capabilities to Kubernetes So when I say capabilities, I mean custom resources like the integration that we have talked about before So this custom resource allow you to do several less thing on Kubernetes And these custom resources are divided in three major areas build Serving and eventing let's focus for now on serving only because it provides some primitives So custom resource to create services that can scale up and down depending on the load So including if there is no one using your services every scan also scaled down to zero And this is really a nice thing and what we do in camel K about K native Well, K native is not present by default on Kubernetes or openshift it can be installed And when you install camel K on top of a cluster that has the K native the operator automatically configure itself with the K native profile It means that when you run the integration camel run The integration file instead of creating a standard deployment The camel K operator will create a K native serving service And this changed a lot the way it behaves because a K native serving service It's a really cool thing. Let's focus on this API. You see here rest post So we are going to define a method post on a path and the point So this is a rest service that we are going to expose using camel K And for each message received by this endpoint It will forward to two systems system one and system two that can be one of the three and two then more components Supported by camel using a custom protocol When you say camel run this integration it creates a K native service But there should not be always something running. So at some point in time The K native service can have some pod running or the pod may be up killed So a K native service is like a schrodinger cut. It can be live and dead at the same time Oh, you have the only the the only way to to know if if it said it's to try but fortunately As soon as a new request arrives to the K native to the to the kubernetes name space even if the the cath if the pod is dead K native is able to create a new copy of the pod And then the request is intercepted by east or here and then when the pod is created and ready The request is provided to the pod that does your code execute your code your integration code And as soon as no request start to come for a certain amount of time the pod is killed again So this is really cool. And this is often by camel K together with K native And it works also for scaling up. So you have a lot of requests coming at some point You can configure it to scale up to for example three pods So that the load is managed about as soon as the load Finish you have nothing in your namespace. This cool things works also with K native eventing We have not talked about K native eventing, but I tell you there are some other primitives for Yeah, eventing in in K native. So for example, the most important one is the channel A channel is a published subscribe resource like a Topic or an any jms topic So someone can send the events to a channel and odd services can subscribe to a channel So when you write an integration like this from K native channel a to system one and system two So the camel cooperative creates a K native service and then I create K native subscription The K native subscription links the channel to the service and this is how it works So when someone send an event into the channel and it will be a cloud event So go for cloud events.io to look on how they work, but they are HTTP calls basically The event is stored inside the channel that it can be backed by Kafka or and it can be backed by any memory Implementation. It doesn't change the behavior. It's stored in the channel and then Since our service is subscribed that the pod is created with your code and then the event is forwarded to the pod and then to the systems the external systems With channels in K native eventing can create complex pipeline of processing and you can use camel actually in every place in this Pipeline you have seen the integration function the one on the right So where camel is used to forward events toward the external systems But you can use camel for the enterprise integration pattern capabilities in the middle to route events between channels using dynamic routing But last but not least there is this concept of event source. So use camel to forward events from any component Any system any external system to IK native channel for event source We have provided also a new cool stuff. So this is the native camel sources in K native This is not the camel k repository. This is the kinetic eventing repository Where we have provided camel sources camel sources are a simplified version of camel k resource The people also people that don't know anything about camel k or about camel can use They just configure some properties of the camel components And then they can use the camel component to forward events into a k native channel And this is really a cool thing a really good achievement for camel There is a video, but I will not show it But you can see it when you will have the slides because now it's the time of luka that will talk about camel k and carcass So I hand over to luka so Hi everyone. So let's talk a little bit about camel k and carcass So the first question is what is carcass? And from the website we can define carcass as a kubernated native java stack Which is based on the best standard and library which targets growlvm and opjdk And of course among of the best library there is camel and camel ply play very well with carcass But why carcass? so The reason why we need carcass is that A traditional java cloud native stack are not very well Good citizen in a cloud environment because usually we want to have a better density and if we compare A for example a spring boot java stack with a node.js or a go we can see that java Doesn't look very well. So a node or Go can have a much better density Another reason is that in environments such as k native where we need a fast startup and we need to be able to quickly answer and Request and And eventually we need to scale to zero when there's no more loads coming in our system The typical startup time of java is not very very good And so how carcass helps cloud native java It helps because it's Provide the first class support for growl and substrate vm which means that we can compile our Java application into native code So which means that we are going to create a binary executable very similar to what happened with go So we don't even need anymore at jvm And another very cool feature is that it helps and provide the primitives to move Um Most of the initialization logic a build time Which means that when your application start it doesn't need to initialize for example your jpa stack, but Everything is pre-compiled and pre-initialized at a build time And it also Provides some int to the substrate vm to maximize that code elimination Which means that some code that that is not even reachable is not going to be included in your application And uh, this helps because less code you have and faster your application will be Now this is a very very, uh Small overview of what carcass does and to be honest A new session a long session will be needed to explain what carcass is But luckily here a definition there is a session that introduced carcass And so if you have if you need more information about carcass I really encourage you to go and look at that session But how can we leverage carcass for camel k? So we can warm up the camel context at build time. So which means that we can discover camel components um Languages time converter or whatever at build time So it doesn't mean it means that a runtime camel Do not need to search and inspect your class path to find out component and so on and Which this allow us to uh, create optimized integration Which leverages build time optimization, which means that when you Deploy your application your startup time and your deployment time will be even faster Because you have less thing to do And we can eventually have a strategy in camel k to generate a native integration So which means that your integration would be even more faster that what we said before So this is a very short demo And this is very very short because the start type of camel and camel k is very very short So let's try to run it and i see if i'm able to stop it at the right time So in this very simple demo what i did is run a javascript Integration Which does something very very simple. I just use a timer and periodically log something to the standard output but if you look At the start time of camel you can see that the camel content is started in One millisecond and the entire application is started in 15 millisecond, which means that At the startup time we are able to answer more requests when they come in And here i'm just playing a little bit with Some rolling redeployment to see how fast it is. So as long as you change something in your dsl code Your integration is already deployed and restarted and everything is very very very fast And That's all about Quarkus if you need more information that i said before Quarkus require a dedicated session. So you can go on the quarkus website on check the Redat definition session fast session So let's talk a little bit about camel k performance As you said as you may be noticed before nikola did not even Write any information about how the project should be built Or how it should be what are the dependencies and so on And this is because the operator understand the code And so because it can understand the code it can find out which is what is the Life this runtime for your integration Which means that if the components the common components support quarkus We can eventually leverage quarkus for the faster startup and because it's no Your dependency set by looking at your code it can choose the minimal set of components required by the code and first for the same reason it can optimize camel and Eventually also the jvm basic on what you brought in your In your dsl And because it understand your code it can eventually understand that you did not introduce any new dependencies which Speed the deployment the redeployment of your application even further At the end if we compare camel k with a traditional spring springbook stack What we have is an integration which required less memory and less cpu because it has much less to do and Also, we can improve the redeployment time because we With camel k The generation of a new uber jar is not required And so let's talk about synthesis and I will tell you after why So synthesis is a web-based based integration platform targeted the citizen integrator And with a few clicks you can create your integration. We can perform powerful data mapping In a graphical way. You can design your stpi. You can integrate with triscade for epi management And we are working to bring camel k As an engine behind synthesis and why I talked about synthesis is because we had We experiment a little bit and we try to figure out what are the benefits of using camel k Against the current springbook back end and the measures are quite quite good and in favor of camel k, of course so if you look at the here at the graphics at the blue bar is the camel k time to deploy an integration or to redeploy an integration And the green one is the technology used now by synthesis. So as we can say Uh, the difference is very very high So We will bring camel k for sure in in synthesis Let's do Very quick for the cup and see what's next So What is coming k? I like very much the sadness is a lightweight integration platform born and Kubernetes with serverless super power And which means that a camel k run on vanilla kubernetes in run on open shifts And it Run very well in systems or open open shift or kubernetes In which you have k native installed What's next? Um, so we are working to support camel tree Which is going to be the next major release of a camel which has a much better modularization of the Uh of the core which Help us to reduce the footrain. We are going to introduce the web book meta components which can help um component that traditionally may not have May not be able to scale to zero to scale to zero And we continue the work on k native side and we are going to create Dedicated camel k sources for most of the component or all the component Which means that when you deploy a new uh camel k source On k native you don't need to know anything about comment, but it's going to be all about configuration of your source we are going to um Integrate our camel k operator with the operator hub. So you can install camel k in your system much easily And I said before we are going to integrate camel k as a back end for synthesis to improve the developer experience And we are going to provide some better idea support. So better completion and Better integration with deployment lifecycle and of that kind of thing a dedicated camel k ui and some support for testing your route Within camel k and your cloud environment as well as some better integration with ci tools And so That's all from us and thank you if you like camel k go on on github and Start it use it and contribute because we we really love contributors And now is up to you were Okay, well, we have totally run out of time. We went over our timeline for today Make sure you get the presentation materials out of this platform. You'll see them down there at the bottom You can download the slides from there Hopefully you guys got good information from today's session I actually really enjoyed the chuck norris demonstration I even pasted some of the chuck norris jokes that I received into the chat for people to enjoy there But make sure you do check out our previous dev nations on K native we have two of those as well as a one hour big session on quarkus itself So those two I'd highly recommend. I want to thank nicola and luka. You guys did a great job with those demonstrations I really enjoyed it Really the chuck norris demos are really funny as hell So thank you so much for that. All right. Well everyone. Thank you and have a great day