 Welcome. Many thanks guys for being here. It's nice to see a lot of people interested in workflows in general My name is Ricardo Zanini. I'm at Red Hat. I'm a principal software engineer and today we're going to talk about workflows and Basically two projects that I'm involved in the community. The first one the CNC app serves workflow specification Our implementation at Red Hat what we're doing for that spec and a little bit of Demonstrations use cases and as promised in the description of this talk by the end Hopefully you guys would be met will be Able to create your own workflow project using this technology, right? Okay First thing about the spec itself It is a CNC app sandbox project for quite some time. We're working towards incubation right now it is a DSL to describe workflows, so we are working through these To be a vendor neutral with specification to describe workflow, so Any kind of technology or implementation on projects out there being you know open source or not Can use this back, you know all the the workflows descriptors The parts of the specification to do the all the implementation in your site. I'm gonna talk about a little bit more about that Being a spec on CNC app, you know open source. We are focusing on standard So everything that we do everything that we come act or Are supposed to have a standard so it is like Open API gRPC all those kind of thing all those kind of things it is Related to the to the spec as well. I'm gonna explain that a little bit more And of course, there's a lot of projects and companies are at helping us there in the in the in the spec site And we are of course working looking for contributors So if you're interested in workflows or if your company is somewhat interested in workflow Would be nice to have you there No to share your ideas or maybe taking a look in this pack and see if that feeds your use case or not If it is not we can talk and you can change some things Everything is, you know Open to talk. So it is a very well welcome and warm community So go there and if you scan the QR code you went to the server flows workflow that I owe There's all the information is there. We also have a Slack channel at the CNCF like so you go for server's workflow and you have a channel there We can connect and talk and you can ping me offline if you want Okay, let's talk about a bit a bit more about the specification itself So it is based on standards like I said the first thing is cloud events. So a workflow running on serverless infrastructure is supposed to have, you know support for events support for cloud events, of course because We are tied to that specification as well. Well So any we choose cloud events because no obvious reasons either like a standard it is open is not within a CNCF as well and Has a way to structure your events and for workflows. That's would be super handy because you can Use the events to start a workflow you can produce a workflow from now from you come to this an event from a workflow You can consume an event from a workflow. So it is pretty handy. I will show you a little bit more about that in a minute Also to connect to other services, you know, like we have a workflow and you need to compose other services You usually have to connect To external services. So for that you can have open API specification to connect with your workflow To describe Your service and methods that you want to call and you use open API Specification to that as well as in API JRPC and GraphQL all of them are supported By spec. So you can describe your functions within the workflow using all those standards and of course we have workflow patterns like Control flow for execution order error handling data management data filtering data transformation We have an expression link not me don't have an expression language itself But we do support jq and json path. So while you're Running your workflow and imagine that you're composing with other services You are calling other services and orchestrating your services Sometimes you need to change the payload or you need to change it the json that you're receiving or We anything with it with the data itself. So you can use jq or json path within the workflow runtime to change the data Let's go Okay Well, this is the main building blocks of a workflow within the specification the first thing is like functions definitions. So like I was describing in the previous slide We can connect to other services via a sync API open API, etc. So there you describe how your range Call those functions and how that function should look like the arguments inputs authentication and other things Events so you can describe which event that you are producing or Which event you are consuming within the workflow via the events below Sorry the event definitions and then the last but not least states they're when you describe, of course the states of Your workflow, right? So this is basically the backbone the The the fundamental structure of the Workflow based on the service workflow specification There's a lot of more much more things, but in a nutshell, that's how you describe a workflow so you can use either json or YAML files to describe we support both and You can go to the Serverless workflow.io and we have a lot there of course the specification itself that describes everything in detail And how you suppose, you know manage all of that and okay, so Let's move forward on that and now speaking about the Project that I'm also involved with that is the implementation of the specification. So we have This work on CNCF working with respect the specification is super nice There's a lot of people a lot of companies helping us there, but also To engage with the specification to have something we need an implementation of course implementation Runtime that is capable to run the the workflow definitions that you that you Have defined before and you know json or YAML file you need the platform you need the runtime engine So that's when we come up with this idea of this project that we call Kojito that is It is our implementation right at it is not a product yet. It is the we are working in the community but we are Leading a path, you know, we think that we didn't call money to to bring that to the product unfortunately, I can't disclose About that, but yeah, it is like a project based on Kubernetes and K-Native that is our idea of infrastructure in the cloud. So for obvious reasons K-Native would be our No chosen in serverless infrastructure to be viewed on top of and I know Who knows Quarkus? Just raise your hand. Okay. Nice. Well, um, Quarkus is it is a Framework for job applications who can create your job applications. Usually in the past people use Spring Boot, J-Boss, there's a lot of tooling there Now Red Hat's talking about Quarkus. Quarkus. It is a job framework It's focused on cloud native applications so For us would make a lot of sense to be on top of Quarkus our platform because our language of choose was Java and The runtime offered a lot of things among like extensions So in these extensions we have authentication persistence, you know network a lot of things that we Decided would be a nice addition to the project as well And of course on top of that we have the engine itself that parsed the workflow that runs the workflow that have the definition And we have a dance that you can have well For this workflow, I wish to persist on postgres database or I wish first my workflow's instance in on a MongoDB whatever Or I need to engage with Kafka or any other broker technology so in this case we have a dance that you can like Create and your application your workflow application amount like a puzzle, you know with building blocks of all those technology So you can deploy your application in the serverless platform All right, so This is super nice. I will but just just just talking right so it is nice to Start in doing some demonstrations and what we can do with this technology That we have now In this care code you can you can scan and say for later You can take a look into the repository that I have this application place This is a use case That we come up with That could be leveraged along the workflow technology So imagine that you have this on use case of a newsletter subscription So someone enters in your enters in your website or you know your your platform and we still Subscribe to a new to your newsletter or something that you have there So the next step is like well, let's verify if this email is you know, okay Does exist in our database or not? We subscribe and we send an email to the person that subscribe to the to the newsletter or whatever and We wait for that verification because now someone could have your email and go there and subscribe for you And you start receiving spam and you don't like it. So it is nice to have a way to verify for the person That sends that email. It is that person so In that in that part the workflow should what? How to and wait for the verification itself or the person that subscribes to say hey, yeah I did that subscription and I wish to have that news are in my in mailbox Well, and in the end after receiving a verification we can broadcast this new subscription into the platform What that means? Well, we can produce a cloud event Within the platform and other you know stakeholders actors other services brokers, whatever can listen to that and Act upon that event and do a new thing imagine. I don't know maybe Brody casting to your marketing team and say hey We just received a new subscription. Why not send the know a welcome email for them something like that? So this is a I believe a simple use case that people can you know understand and How that could be how we could leverage our workflow technology to implement this So imagine now that we have this Service that has our subscription database So it is a rest service in your platform and you need to interact with that service and you need to call that service you say hey I wish to I wish to subscribe in a new person. I wish to Confirm that subscription and whatever so how do I call that service that external service? And when I wait for a verification, how do I do that? How do I halt my my execution and wait for a new event to come or a new request to my workflow to come to resume? the workflow and no further This is the infrastructure that I come up with You know like I described the coach the project is like Building blocks with based on Quarkus Kubernetes k-native So we give you the tools for this first iteration of the project It's more focused on developers. So if we give you the tools so you can you're capable to implement something like this And in this case you have like us I receive a new request of a new subscription I do you know, I persist that that information my workflow. It's a candidate of service By the way, my subscription service also it is a candidate of service could be you know a lot of candidate functions as well We work, but in this case it is like one service just for demo purpose So and my workflow will make you know requests To the subscription service. So how can we do that? For this demo we are using the open API Definitions so we can call that service that service has their own database and I'll do all their stuff there and Our workflow will house the execution and waiting for a confirmation emails as soon as the people Click on the confirmation email. We come up with KO 21 in the candidate platform and We resume the execution and the the final subscription. So let me show you Is application running? All right So this is the front end Of our subscription application. It is just a demo. Please don't take that. They take that with a grain of salt In the care code that I showed you in a couple of slides ago. You see you have the the link for the Github project that has you know all these services in there the description and everything else I will you can take a look later if you're interested and Let's get back to the application. All right So if we go in our Kubernetes instance, we don't have any pods in this namespace we have only the Postgrease database that is the technology that we are using to you know Persist our information persist all these subscription things and workflow executions and cetera and As soon as they like create a new subscription, let's let's see if that works. Please work All right, let's put my email here All right, I suppose to add a loading screen, but When I do the first request My pod starts working, you know, we skate each one Because we need that service the workflow to start execution the execution and wait for the confirmation to be done so we can resume the the Execution of the workflow so we can wait a couple minutes coming up a couple of seconds And you see that all the pods we just you know We skate to zero because we are using the serverless infrastructure technology and I don't know if you guys were Yesterday in the candidate calm, but we had a lot of great talks. One of them was about Code starts so that's why you know, I didn't do all the things that I supposed to do You know like caching the image or things that would be able to start my my pods Quicker, so that's why it is the and taking you know some time to just just to skate you one So meanwhile, let's take a look into into the flow itself so you can understand What I did there? Okay, please internet work All right, so this is a Java project I'm gonna explain to you guys in a few moments how you create your own, but yeah This is our just a regular Jason resource file within my project That is the description of my workflow. So in the first part we have the events here We have two events one Like that I can produce and one that I can consume the one that I can produce It is described like well as soon as I end the workflow I will create a new subscription event and I have one that I can consume that is the confirm the subscription confirmation event and Also, this is the description of my functions. So my functions. They are are all based on open API Specifications so they within my project I have a YAML file this you know describing my open API and In the end after the hashtag you can see the method name of that open API spec This file for demo only it is you know in the project But it could be you know a remote file what HTTP you can access via HP file system whatever class path to support a lot of Ways of no to retrieve the specification file. So in runtime the engine will Generate the code the rest of stable to call those rest services for you So and if this open API has like, I don't know authentication and other things We also generate those things and you can configure Your calls using whatever authentication mechanism you have like a P API key or a wall of two whatever and Here's the description of the state self the the sequence of the states. So Jason is a little bit odd You know to see so let's take a look into the image itself. I think it is easier to understand This is based on an editor that we are Currently working on that you can notice you can type your workflow We have Intel sense and in the other hand of the s code you can see The the workflow being created. I'm gonna show you in a couple of minutes so The first thing is like well, we receive the request with very five mayors is valid or not and and if it exists in our database and if it exists We just finish the workflow. There's nothing to do We just receive something someone that's already subscribed and that's it and on the other hand if we don't have this this email on our database we subscribe we insert this this this Information in our data in database or we call this the service we call the the subscription service and say hey This is a new subscription save it And we halt we stop. This is a callback Tape type of the state so we stop we halt like I showed you in the demo and Let's see. We don't have any pause anymore and I'm going to confirm my subscription else we confirm our subscription we resume the execution of the workflow and We do the confirmation state, which is another operation that we call this remote subscription service and say hey this person is now subscribed to our newsletter and By the end of the workflow we produce a new event and Let's see that how that work it You know, we have both services the workflow service and the service that we Just called and I have this This is just a way to display to consume the event that we just published It is a an event's play container from Knative You can see the the cloud event that we produced based on the information that we have there So anyone in a platform could listen to this event and react upon that so you can build an even driven architecture Based on this technology as well Okay, all right. We have like 10 minutes and I would like to Fulfill my promise that I have In this in the description of the call of the talk. I hopefully you guys Are waiting for that or not? I know but Yeah, let's try to do that together. You don't need a laptop or anything. I will do everything here This is how we're going to create our first workflow so you can you know Try technology understand what it is Play around with that Even though you don't know Java. I don't need to know Java. You just need to know play around with the with the with those two lean This is the like I said, this is the first iteration of the project. So in this first iteration we are aiming for Java developers my job about but developers in general that can you know Use this technology be their own workflows, but in the future that we are there's plenty Well, you don't need you know to know any kind of underneath technology whatsoever It's it I will show you guys a POC that we are preparing So how you can leverage workflows without knowing this technology just you know drag and drop and know the Boxes of the world the states of the workflows describing your functions Assessing service registry to retrieve your functions to call to do you know a lot of things well For this stage, what I'm gonna need your job SDK, of course, maybe in the Quark of CLI Quark CLI It is the tooling that we chose to build on top of this technology and what we are doing right now to create a new project so This command line We'll create a new project from the scratch So you don't you don't need to do anything. You just have to run this and let me Run here No, not here wrong Okay, maybe here. Okay All right, so oh Gosh, it's terrible. Let me see if I can Yeah All right What what what we're trying to do here? So I'm creating like a skeleton of a project with some extensions and some building blocks From Quark is and from Kojito to create this project and in the last line It is the the name of my approach so what my name space and my name of my project and the version so I just Sit sit up. Whoa. All right Yeah, this happens all right So what Quark is gonna do is going to create a A project for us so we can go ahead and openings on the visitors code and open this Folder here that we just created see Where it is? No wrong Documents all right, so this is just a regular Java project. There's nothing things there's nothing new if you if you if you were familiar if Java you'd be you know, super comfortable to work with and In the resource directory, I'm gonna create a new file This is the name of my workflow the name of my file, whatever they want And then I have to describe like this as they blew and the YAML file or it could be a JSON file But I think that this audience prefers YAML file, right? Let's go and copy and paste the workflow so we can not take too much time I'm gonna share this presentation after you know in the in this cad web application so you can download there, but In this QR code here you can scan and you can have access to this person at github so you can do whatever After the presentation itself All right Let's copy and paste here and you see the editor will Replicate what you just described in your workflow into a nice image so you can have a big picture so we you might also Talk with business persons or you know another stakeholders or people that are interested in the work that are doing and what you're doing And they can see clearly this you don't need to be you know Super technical to understand this kind of stuff. So it has business value as well So let's try to understand what's what we are doing here. So the first state is just a state to inject a data in our payload in this case hello and the next state We're going to just know use our built-in function that you know prints in the in the in the console the data that we have and In the end that is the interesting part that is the state that a future. So As you know workflows works like this the input of a workflow It is the output of the the previous zone, right? So in this case the last state will produce a New payload because we have this state that a filter for output. So the output of this last state the print state We want to apply that jq expression there. All right. So let's see that working. Well, I have yeah, we have time Let me see a new terminal All right So if I run Quark's dev Please work It will compile build my project and Again start in what we call in Quarkus dev mode So you can access the application and play around with that So, yeah, that's Please work. Okay Yeah, we're fine Yeah, no Totally fine. I have time. I have 10. Okay. Yeah, thank me. Shh All right So this is just regular Quarkus application if you go to the Quarkus guides and create a new application, you'll see, you know, something like that and Interesting part it is the swagger UI. So what could you do this? It is Take your workflow. Take your description and generate a new rest application for you So this is like a regular rest service within your environment. So you can do whatever you want. Just what what what happened? Please help All right, thank you Okay, so we generate an open EPI Specification for you. So imagine that you have a lot of workflows and you want to call them You can import all these, you know, Specifications between them or you can use in postman. You can use whatever you want and this is a In a sense a coastal workflow application for you So greetings is the name of a workflow if you recall in the idea of my workflow I have the word greetings that would be, you know, my endpoint here. So to start the workflow I have to make a post Request to this workflow. Let me All right So I have to do a post request to this workflow with this Jason payload here We have a way to describe the input It's Kim for for the workflow for you know, simplicity. I didn't add so I have to add manually here but if you if you add a Jason schema for the input of Your workflow it will be there. So it would be nice. Let's say cube call and I can execute All right this is the response of The execution of my workflow. So it is hello cube call and pretty pretty funny and easy to do Lame I know but it is just for demo purposes You can download the other example that is much more complex that a lot of other features there But the nice thing is well, what happened? I Don't know Okay, start again Whoa, I follow her and being detected Java. Okay Never seen that before Five. Okay. This is the last thing Yeah, well, what I was going to do is like well while in dev mode you can Change whatever you want in your project like instead of hello. I cannot hide and This brings a lot of value to the to the developer So when you you're creating a workflows, you're trying your testing etc So you can leave in that mode testing whatever change your workflow anytime that you change and you save the file And you do you know another? Execution or we refresh the application You you see the change that I made In your in your application. So in this case I changed hello from high and just you know as magically Changed the application as well. All right last thing It is the oh Where it is? Okay here. All right We do the dev and now you know about deploying so what this? Quarkus application does it is like we generate all the demo files that I need to have in order to deploy on Any Kubernetes instance that you have so in this case I have me in cube. So we have to set up a few things But first it is the yeah, I want to delete this stop. Please. Okay All right So yeah, first thing is like we're preparing my Mini-cube environment so I can push the image to the internal registry easily That's the way I do you can do the way you want that doesn't matter It is just a regular Java Quarkus application in the end and here we're going to build the image based on the project that we already have and Generate all the emo files to be able to push to a creative environment crystal has a very tight Integration with K native so we have an add-on that calls K native eventing and when You have events in your inner workflow. We generate all the K native objects like source syncing bindings triggers brokers etc in order to You know bind the the up your application with the K native platform So this is really cool in the example that I showed you about the newsletter subscription to go into the github You can see that in practice All right, so Please build the image. I don't know what's happening today. I test this multiple times and it was like one minute Come on All right. Yeah, the Wi-Fi. Yeah Yeah Please demo gods. Okay. It is working So, yeah, since we have access to the mean cube Registry you can see our image that just pushed to the to the to the history right now and Quarkus and cogito will generate the Information The information that you that you need, you know, the demo files that need to deploy in your in your instance So in this case it is pretty straightforward. I can go there and apply Hopefully we work Please work. Yeah, and I can do something like this scan service list And you see, you know the service there. It is Wrapping up becoming ready becoming ready. Okay, it is ready and we can access and it's the same application Right. So, yeah, that's the that's the idea behind all I hopefully I could you know Go through all of that. We have only one minute two questions. If you have any questions if we not you can Ping you offline that's the way I'll be around if we can talk all right main. Thanks guys any questions All right. Well, this is the the networks the social network So my LinkedIn there more examples and blog if you want to take a picture and see we can talk later. Okay. Thank you