 Hello everyone. Good morning, good afternoon and good evening, depending on where you are located. Today I'm going to talk about Ballerina, the open source cloud native programming language. More specifically about its next version, so on there. I imagine seeing that currently working on the Ballerina project at WSO2, I'm also a member of the Apaches of Dev Foundation. Let's talk what's Ballerina in simple terms. Ballerina is an open source programming language built for the cloud to make it easier to use, combine and create network services. Before moving on, let's have a look at a little bit of history on Ballerina. Work on Ballerina programming language started in 2016 and the language was created by WSO2 and the first table release was done in 2019, which was 1.0 and we presented that question at Open Source Summit in Japan last year as well. The next major version of the language is named Swan Lake and it's a complete revamp compared to its predecessor and we have made a lot of use of built-in improvements and reliability improvements. We are planning to make it generally available in quarter one next year and right now beta versions are available and beta 4 is the latest version available. During this presentation, first I'll be talking about why we decided to develop Ballerina and then I'll take you to a tour around Ballerina's capabilities. Then we'll look at the roadmap and what to look forward to and finally how to learn Ballerina, how to interact with the community and the ecosystem. Let's start with why we decide to develop Ballerina. To answer that, let's consider this. How is it like to develop software for the cloud nowadays? Suppose your organization has several teams developing several microservices and you have to develop a new microservice. Most probably your microservice or your new API that you're going to develop will depend on third party APIs or services or APIs provided by other teams or in your same organization. That means writing code today means integrating or using capabilities provided by other services and APIs. Once you are done writing the code, the next step is to build and package it to Docker. Once that's done, the next phase will be to the deployment. You will have a different environment like pre-prod and dev like that and you will have to write deployment descriptors be it Kubernetes or serverlet and then you will have to deploy that into those clusters. Once you have done with the deployment, the next phase will be the scaling. Sometimes those two deployment descriptors, deployment and scaling both go hand in hand but the scaling part is the next fact that we have to consider. When the load varies, your service should scale horizontally accordingly. Then you will have to think about managing access when other teams or other external parties rely on your API. They start when they start using your APIs, security aspects and access controlling work. Then the next one will be continuously monitoring. Due to the distributed nature, you will have to have a full view of what's going on with your service at the operational level. At the same time, you need analytics to have an understanding of to get business insights and for growth thinking aspects. As you can see, developing software for cloud era involves a lot. It's not just writing code. It works with different areas you had to consider a lot of factors and these are not limited to the ones that we talked about. For example, we have concepts like dual fact-tap, then fallacies of distributed computing, different protocols, networking primitives and security best practices, different deployment technologies like Kubernetes and serverless. That way, the cloud data ecosystem or writing code for the cloud has become more and more complex. This made us think, how much time do you spend on non-functional recurring tasks in the name of cloud data? And how much time do you spend gaining expertise in cloud technologies? That's what we need out of Bellrita. That's how we got the idea of Bellrita. Then you may wonder, what's the problem with existing programming languages or like recent frameworks? First of all, that's good. It's a good way to keep on going. But we saw a few fundamental issues. First, almost all the popular programming languages create network as a new resource. But in Bellrita, we treat them the network as an inherent part of the language. And when talking about the cloud nativeness of existing programming languages, they have been repurposed with libraries and frameworks. So when you are to make your true cloud nativeness, you will have to use a stack of different libraries. And not that a library or a framework is another level of abstraction that's provided on top of the abstraction provided by programming language. What will happen if you want to go beyond discover the framework? Then at that point, you will no longer be in the comfortness of the framework. People usually go with libraries and frameworks because they are familiar with the underlying programming language. Considering all those facts, we thought of doing Bellrita. And when talking about Bellrita, instead of repurposing existing technologies, Bellrita addressed them from the first principles. And Bellrita is zero leakage. That means anything can program with Bellrita and everything that's in code is usual. Bellrita has a good low code aspect. We will see in the end of the presentation that part as well. And Bellrita abstracts the network interactions and saves the developers from fallacies of distributed computing. The most important thing is Bellrita let developers to focus on value addition into their business domain. Due to these reasons, we think Bellrita is an ideal candidate to be the programming language for the cloud dealer. To get more understanding, let's take a deep dive and have a look at what features capabilities Bellrita offers. First of all, before starting on that, to set up Bellrita, you will need to install you have to download the Bellrita installers from the website. You can visit our download page and download the installer matching your platform with Windows Linux or Mac OS or if required, you can build it from a zip. You can download it as a zip or build from the source as well. And once you have installed Bellrita, you can verify if the installation was successful using a command-like version. And the next one that comes to our mind is the IDE tooling. For that, Bellrita has a feature rich VS Code plugin and you can download it from the VS Code marketplace. Let me show that to you. So in the VS Code marketplace, when you search for Bellrita, the first one that comes up is the Bellrita VS Code plugin. You will see a deprecated Bellrita plugin which was for the Bellrita 1.x versions and this the one that we are using is a new one and targeting this one decrease. Download and install that one. I have already downloaded that and before getting our hands dirty, let's discuss a bit about how Bellrita looks like as an overview. So Bellrita is a flexibility type, relaxed language and it's reliable and maintainable. Bellrita is a statically type so that type compatibilities are validated at the compile time and it's structural. So Bellrita compares the shapes of types instead of the names to determine subparibs. And Bellrita has explicit error handling and Bellrita is concurrent set and it has a familiar and intuitive syntax. You will see that while we are doing the demo in the upcoming slides. Let's move. Bellrita is open by default. That means Bellrita tries to be conservative in what we are sending and be liberal in what we are accepting. This to demonstrate that this is an example. This is a closed record named product and if you look at that, it has fields called name, description, price and currency. These are required fields and it has a field name ID which is an optional field and then it has a rest field which is of type JSON. That means a product should have name, description, price and currency and optionally have an ID and there can be other fields which are subtypes of JSON like in float, string and JSON itself. Like that. You will see them in action in the upcoming demo. And Bellrita is data oriented. Bellrita has a rich language integrated SQL like query syntax which you can use to query, list tables and streams. Yes, Bellrita has streams and tables. Stream is a good way to process events or process large amount of amounts of data without worrying about the limitations and table syntax is to represent a table. That means a collection of records where a table has a key and a key can be a simple or a complex one. And if you take this query example, we have a products list and we are querying for the products which has a price higher than 50 and the currency is USD. And at the same time, we are converting the price of the product into GBP by applying a conversion ratio and then returning a new set of products whose currencies are in GBP. So you can use this language integrated queries in interesting ways and intuitive ways because SQL like clauses are familiar to us. We have the from clause, from let limit order by where those clauses and select clause like that. And Bellrita is good. Bellrita has a concept called strands which are like threads and Bellrita has workers which are the realization that means workers are the ones that are going to spawn strands and you can use futures in Bellrita to run functions synchronously. This is an example of using strands and workers. So here we have two workers worker one and worker two and you can see that worker one and worker two are passing messages across them using these arrow icons, arrow symbols, they are called synductions and at the end the main strand or the main the function is waiting for both worker one and worker two to finish. A thread in Bellrita can have multiple strands and only one strand belonging to a given thread can run at a given time. So it's cooperatively multitasking. Yeah, this is just how to run a function synchronously. You get a future and you can wait for the future to complete and do something else as well. And the other interesting thing about concurrency in Bellrita is asynchronous IU. Bellrita has a concept called remote methods and when you are unlocking a remote method Bellrita runtime make sure the call is not working and but I'll demonstrate that during the demo I said and this is really useful when you are handling a large number of connections and you don't have to use explicit callbacks or listeners to handle the asynchronous behavior. The other aspect is Bellrita is graphical. Bellrita has a graphical representation using flowcharts and sequence diagrams and it's leak-free that means anything you code in Bellrita language can be can be visualized and vice versa. It has a really good local recipe which you can use used to which is good for non-technical people or less technical people to understand code logic or to do coding it's local programming as well. And this is a simple example of such flowchart of a method. Now let's move on to the most important part of Bellrita. That's the cloud net in this. Let's get our hands dirty for this. Let's build a simple currency conversion service which will behave like this. So this is the request that we will be sending at the end. So it will have two part terms one is the base currency the other one is the target currency and an amount. What this means is the amount is in USD right now and we want to convert that to GBP and in this program we will be using an external service to get the exchange rates and do the conversion. Now let's go to VS Code. Okay. I have already created the Bellrita project and this is my Bellrita project. As you see the Bellrita project has this Bellrita automobile which is the main configuration file which specifies the package name and things like that and also the dependencies and main dot bell is the one that was generated automatically and dot bell is the extension of Bellrita's source file and let's try to our service. Now in Bellrita, I said that network imprimitives are built to the language itself. So Bellrita has a concept called services, listeners and clients. So in our case what we are going to write is an HTTP service specifically HTTP REST API and it will have a gate method. To represent that in Bellrita we can simply write a service on an HTTP list like this and we are going to listen on for NAPA 8080. What we created here is a service, the HTTP service because our listener is an HTTP listener and port is 8080. The listener is the one that's going to interact between the network and the service and listener will be taking the messages coming in through the network and passing them to the service and to the resource methods. The service has a set of resource methods and in our case it will be a gate method, a gate HTTP method and note that our request will be current slash then path parameters and the query parameter. We can write this in Bellrita like this. So our context path is slash we gave it here and from this point on that our request path is current then we have our first path parameter which is base currency and then we have the second path parameter which is the target currency and we have a query parameter which is a float for the amount and this will return a float. The float will be the return one will be the converted value. And within this resource function we have to invoke an external API to get the exchange rate. For that I'm going to use this API and to invoke that we have to create HTTP client. I'm going to name it DCC client since this is like dynamic currency conversion and you have to specify the base path of the when you're creating the client and yeah okay we create the client and now we have to invoke the external service to do that we are we are going to send a gate request and this is how we are going to send that gate request in Bellrita and as you can see this is the remote function call this is this is the remote function invocation in Bellrita. I'll talk about that later as well and we need to pass the base currency here to get the conversion rates and to do that I'm going to use the spring templates in Bellrita and so that I can pass the base currency as a parameter like this yeah just like this and now we need to get the response I'm going to get the response as a JSON like this and note that Bellrita has simple support for JSON and XML and here we are directly accessing the response as a JSON and note that in Bellrita you have to handle errors explicitly. So here what it reports is it says since this remote API call can fail it says it will return either a JSON or an error. So if there was an error we will use the check keyword to check that and if there was an error this will simply return the error and to symbolize that we will have to say this will return an error or a fault and let's log the response that we are getting first and let's say response and when you are logging you can use key value pairs like this and okay so we created this the basic implementation where we simply for now let's return zero here and yes let's run this program and see what's the response that we are getting so based on that we can do a lot of improvements to our service. I'm going to open another terminal and get our current command ready yeah I'm going to send a request to connect 100 US dollars to GVP and okay okay there's a typo here let's rerun the service it log the response and let's take it out and see how it looks like this is the response exchange rates response that we are getting and when formatted you can see it returns a success Boolean based the currency code of the base currency and the rates which is a map and each key is the currency code and in front of in front of the mother exchange rates let's represent this in barina using the record I'm going to create the record called conversion response and which will be an open record I'll tell you why and we know that there will be a Boolean called success and there'll be a string called base and a map of floors called rates and instead of yes and now we are going to say we will be receiving a conversion response now this is where the open by default principles come principle comes into play so in this response we saw it has a lot of fields but what we are interested in is the rates and whether the request was successful or not and the base currency code we can open that as well if required and by having an open record what you're saying is this is what we expect and if there are other fields that's fine you can have them but what you're saying is these are the ones that you're interested in and since now we have the response we have to take if the response was successful and if it wasn't we will have to return an error if it wasn't successful you'll have to return and say error saying exchange rates could be obtained and if it was successful we know that the rates contain our target currency which is GBP and this will return an optional slot because this key can be in the map or not and let's say right in Bellara you will I said that in Bellara you will have to handle errors explicitly and it's null set so because of that we will have to we get an optional slot and here we will have to check if rate is not there or rate is empty if it's empty that means we couldn't get the the exchange rate for the target currency and we will be printing that and we will add the target currency as a parameter to here as well so that when the if the error was locked it will be printed as well and from this point onwards after this checking Bellara compiler knows that rate rate is the flow so that we don't have to do any casting and Bellara compiler itself does the type narrowing and we just have to return the rate or the rate multiplied by the amount so this will be the the converted rate and I think we did the implementation let's set the log line here for us to see what's going on and in follow up converting currency and this currency is like this so as you can see when looking you can use key value pairs which is really helpful when you are doing log analysis using say log stash and elastic stack and the target currency and the amount and now what we have to do is let's just run this and see how it looks like now and let's send our request as expected we got somewhere around 75 100 USD is converted to GBP is around 75 GBP and similarly we can try another currency it's 136 Singapore dollars and like that and it's logging our request and right now we have done the implementation and probably yes we can do more policing to the service to the resource method by adding response codes there's a really nice way of doing that I'll just do that here you can say that it will be written in HTTP okay and then you can return it like this and the amount like this and yeah something like that this HTTP okay is an inbuilt record and instead of returning just a mirror you can do something like return bad request and HTTP internal server like that so as you can see this syntax is very intuitive it says we have a gate method like this and it expects it accepts base currency and path parameters and it has a query parameter and it will return an HTTP okay bad request to internal server like that but I'm not going to go deep into that part and I'll be revert it back and the next part is we have built we have created our code and the next part is building and packaging it into docker and also writing deployment in sweepers for that bellina has you can create the docker image using bell build minus minus cloud equals docker with this one it'll be just created in the docker image but in our case we want the docker image plus the Kubernetes deployment descriptors and for that I'm going to use minus minus cloud gates and with that it will output the Kubernetes deployment descriptors as well while it's running in the platform I'll demonstrate one more thing actually I want to demonstrate two more things first one is once once we have written this service like this you can generate the open APS specification using bell open API and give the source file where you have the service and it'll output the open APS specification and you can share that open APS specification with external parties so that they can generate clients and connect to your service easily okay the open APS specification was generated and this is that this is our request path then we have the base currency and target currency as required path parameters and then we have a query parameter called the mount and it's required as well and as responses we have 200 okay and 500 yeah so if you had used defined types here instead of float it'll have those schemas in the open APS specification as well and okay in the meantime our bell build was successful and it prints out the command to run to deploy your the generated deployment the generated artifact through a Kubernetes cluster and also it prints out the command to expose your deployment through your Kubernetes cluster as well I'm not going to demonstrate that due to the time limitations but let's have a look at the Kubernetes deployment descriptor and if you look at that you can see that you have a service and then you have the deployment and in the deployment you have the memory limits and the port not that these memory limits were configured in the cloud.toml file and I had done that done that previously and you can use the cloud.toml file to specify the container image name tag and those stuff as well you can do more fine tuning with the cloud.toml as well and finally it has a horizontal auto scale for you to scale okay now we are almost done with the deployment with our writing our service now we are left with the observability part and before that I'm going to show one more thing that's the configurables in bellina in bellina you have configurable variables I probably we will want the port to be configurable so for such cases you can create a configurable variable like this and pass that into the program using a config.toml file and here we can see to say the port is this and this config.toml can be passed during the runtime or can be mounted to your Docker image like that so that flexibility is there and you don't have to use environment variables anymore and yeah now let's go move on to the observability aspects bellina is fully observable with you can monitor metrics with prafana and from it just out of the box and you can do distributed tracing with open telemetry and we are using GA as the open telemetry implementation compatible implementation and then you can do log analysis using elk by feeding bellina logs to your to log stash or to log stack directed to the docker looking right as and if we are to enable observability to this our disservice we simply have to add two import one miss the jager import and the jager for tracing and then from it yes for metrics and then we will have to enable metrics like this in the config.toml and this is optional and using the config.toml you can specify the jager host and ports and those stuff as well and we have enabled observability for bellina and in the bellina.toml we specify observability included true that's by default true and once we are done we just have to run this and for this to send metrics we need jager and from it is running and to do that I already have a docker compost deployment prepared to create the jager grapana and comitius instances and I'm going to start that test with that I'm going to start from it yes grapana and open telemetry this jager with that and okay those services are up and let's go and look at let's first send the request and go and look at jager so I just sent this this needy request and another one let's set the same request again and let's go and look at the traces in jager okay so our service is belonging to the context path slash and our operation we are interested in the get method for carasecan version and let's find the traces yeah as expected there are traces for two requests and this is the first one as you can see it comes to the resource method and to the it goes to the gdb client and then it goes out to the external service and that's the call that has taken most time and yeah and this it's going to the external service like this and let's go back and see the next request and there's an interesting observation that the time taken for the second one is real low and that's because the client we are using is caching the response and it's returning a cache response instead of sending the request to the actual external endpoint and that's for the tracing you can bellona can trace across multiple services and I chose a very simple demonstration today the next part is with the Prometheus with metrics and for that let's go to grapana and let's look in and skip this one and let's say Prometheus has the data source and let's test it's successful the next thing is we have to import the bellona dashboard and bellona has a grapana dashboard already available in the grapana marketplace and its ids 5841 these are documented in the bellona website will document it and I'm going to import this dashboard and along with that we have to specify the data source it will be from it yes and here we go we got a full view of the our system right now the uptime and the true port number of requests we have sent free so far and the top five services the first one is the metrics endpoint that's used by grapana or Prometheus and these are our services and and remote services this is the remote endpoint that you are invoking and like the list and the request in the meantime so don't you press and let's wait for the stop date as well yeah the count went to five as expected and yeah you can monitor status codes errors and stuff with this and you can explore more through the bellona website and let's move on with the presentation and there's one last thing that I need to mention actually two one is this asynchronous remote method call this call is non-blocking even though it looks like it's blocking call it's non-blocking and it's really useful for even handling multiple a lot of active connections and the other one is the bellona low code view and let me open the bellona low code view for this and I'm going to open the local view for our git resource and at the same time I'm going to open the bellona sort sort side by side and here as you can see this is our service and this is the local diagram corresponding to our resource function and yeah let me yeah so meet like this and it's a it shows that we are sending a request to the external client bcc client using SQL diagrams and we have flow charts here the flow control and like that this is really good for non-technical people and to less technical people to do programming itself or to understand code like that and with that I think I demonstrated almost all the things that I want to show with bellona and not that we covered almost all the aspects regarding related to developing coding for the cloud from writing code to building docker and kuban dc images to scaling to observability and next let's move on with the presentation so we discussed these past listeners services and bellona has support for protocols like a ttp ttp2 that's grpc website you can look them up in that bellona website you can write this api graph ql apis or vrpc apis easily we saw the open api tool bellona htp client support fail or load balancing we see we try those aspects as well we saw how we can use configurables in bellona code and we saw xml and json being available as types in the language and we saw how the response was converter seamlessly to our user defined type and here as in this example you can navigate xml through syntax as well talk about security in bellona we have work to jwt and basic code in bill in bill and ssl mutual ssl and authorization aspects just to give you a sneak peek if you wanted to protect this using with jwt you just have to add this annotation on top of them and in this one we are protecting this service using an external authorization server and using jwt and you can even protect individual resource functions like this and you can access control based on scopes for different resource functions differently based on a custom claim if required like that and yes let's move we talked about the core to cloud aspect and bellona has function necessary aspect as well which we i don't have time to demonstrate but bellona has in-built support for aws lambda and aws assure functions and this is how you could write an aws lambda function you just have to add the aws lambda annotation on top of a function and you look at the aws lambda context and the payload similarly this is a similar assure function but this is doing the same thing that we did in our our service that we wrote this is to convert from one currency to another given the amount and it's calling the same api and the interesting part is once you have written the function when you build it it'll output the safe files that you need to upload to assure aws. Observe will respect we talked about that and for CICD bellona has bellona g-tub correction which you can use to get a development environment up and running within your workflows and overall as we we have talked a lot of about bellona's scalabilities we can say bellona is better is included platform it comes with the package management a good really good standard library and a test framework and ID supporting and structured documentation and like that talk about bellona roadmap right now what we have is j bellona that means we compile bellona to an intermediate representation called bellona intermediate representation or BIR and then we generate bytecode and run from JVM as of now there's a parallel we're going on to develop a native compiler to compile bellona intermediate representation into native code and that's in bellona with that that in mind so on like is the next graduation of J bellona and as I said we are planning to make it generally available in quarter one 2022 and that cracker will be the release after that that that's expected in 2022 and we are planning we are hoping to release the native compiler bellona compiler by 2024 because it's lot of work and a great milestone and talk about bellona community bellona has really good community helpful very interactive you can join our select channel and ask questions in the user channel and you can ask questions in stack overflow as well and you can visit our bellona platform organization and star representries or report issues if you find any and you can attend community calls we hold community calls every month and there's a meet-up group for bellona user group as well you can join them and you can follow bellona twitter handle to get updates continuous updates on bellona and finally to learn more about bellona the best place will be this best starting point will be the bellona website and they are you have a lot of pointers there's this learn page where it has a separate guide for to learn by examples or language workflows and apart from that we have a bellona tech block which is made by the community on medium and we have bellona central which is the place where you can push packages for others to be available and with that we are coming to the end of our presentation and I hope within the limited time I could give you some reasonable idea about the capabilities of bellona and I invite you to look further into bellona and if required get help from the community as I mentioned and to summarize what I discussed bellona is trying to address actually your true cloud nativeness from the first principles instead of free purpose index technologies and bellona is flexible type concurrent data oriented and cloud native reliable material and graphical so talking about cloud native I said that we have network communities inbuilt and we saw how services and listeners are used and we saw the local view for the graphical aspect and I couldn't show you but using the local data you can edit the code as well so simultaneously and well we saw how open by default policies operating with open records and how seamless it was to get responses and use those responses when calling external endpoints and bellona abstract abstracts network interactions and sales developers from the falling into fallacies of the distributed computing and let developers focus more on implemented value-added features for their core business domain and finally as we showed bellona batteries included platform which comes with a lot of package management tool testing framework good idea support good documentation and free rich standard library like that and thank you for following me through this presentation I hope that I could give you some understanding about bellona and if you have any further questions you can ask them now and I invite you to also have a look at bellona after this presentation as well and yeah let's go on with questions if you have any and thank you for following the presentation