The Ballerina programming language has a unique concurrency model that promotes efficient resource usage and provides an intuitive programming model for users. Its concurrency model is also critical to the non-blocking I/O support provided with the communication protocols. In this article, we will take an in-depth look into Ballerina’s concurrency support, and see how the non-blocking I/O operations are implemented on top of this.
Let’s first take a look at the general concurrency constructs provided by an operating system and how they work, and then move onto the concurrency primitives provided by Ballerina.
The operating system (OS) provides us with…
GraphQL has become a prominent technology in implementing data APIs. It provides a convenient and intuitive approach for querying data. Let’s look at a sample use case using the Ballerina programming language and see how GraphQL compares to other traditional approaches such as implementing REST-style HTTP APIs.
Let’s take a typical e-commerce scenario of processing orders in an online store. The entity-relationship diagram below shows a typical representation that can be used in a relational database. This is of course a simplified representation of a real-life implementation.
In this article, we are going to cover the HTTP services support in the Ballerina programming language (Swan Lake release). We will be looking at the basics of creating an HTTP service, and then see how the Ballerina language provides a convenient abstraction for defining complex operations as well.
A Ballerina service’s structure and its semantics are defined by the type of the service, i.e. the type of listener attached. Let’s take a look at how a basic HTTP service is structured in Ballerina.
In this article, we will take a look at how to create long-running workflows using AWS Step Functions and the Ballerina language. AWS Step Functions allow us to define state machines that can have tasks such as executing a Lambda function, inserting a message to a queue using AWS Simple Queue Service (SQS), messaging with AWS Simple Notification Service (SNS), and more. This also encourages reusability by allowing existing services or functions to be composed. You can have rules for defining functionality such as error handling, automatic retry, and parallel processing.
But arguably the most important feature of creating workflows…
In this article, we will take a look at how Ballerina’s AWS Lambda functionality can be used in implementing an integration scenario between the AWS Simple Storage Service (S3) and the AWS Rekognition service.
In this use case, the users will upload images to an S3 bucket where the Lambda function will listen to. Once an image is uploaded, the Lambda function is triggered, and it will carry out an image analysis using the AWS Rekognition service. The result of this analysis will be emailed to the user.
Figure 1 shows the high level deployment architecture of our solution.
In this article, we will show you how to create a serverless solution for implementing a scalable Optical Character Recognition (OCR) system. In a system like this, scalability is a requirement. At certain times, we can expect possible bursts of traffic into the system where we need to process all of these requests and communicate the result back to the user in a timely manner. To cater to this, we need a system that scales dynamically. One possible solution is to model the required workers and deploy them in a Kubernetes environment to achieve our scaling requirements.
Ballerina since v1.2.5 has built-in support for Azure Functions. In this way, you can take a Ballerina function and expose it as a serverless function in Azure Functions. Azure Functions take on a unique approach in defining serverless functions with the function trigger and bindings concept. In this way, we can access other cloud services such as storage services (queue, blob, etc.), CosmosDB, Twillio, and timers right from the function itself without any additional connectors or authentication processes. We map our parameters and return types with these bindings, which provides us direct access to the resources.
In the following video…
There seem to be increasing interest for people in knowing how to migrate a Spring Boot application to Ballerina. Spring Boot has been a very popular platform for writing HTTP/RESTful services; and then came along Ballerina, which is introduced as a programming language that is specialized in writing network-aware applications, thus promising much more productive user experience for the developer. With these new additions, many are curious to know how to possibly rewrite their Spring Boot applications in Ballerina to get the long term benefits.
In this post, I will dissect a Spring Boot application, and show how their concepts…
GitHub has introduced the ability to execute custom workflows for events you generate within GitHub using GitHub Actions. For instance, using this functionality, you can implement CI/CD using GitHub’s infrastructure itself. No need to subscribe for a special service to build/test and deploy your application, but rather these can be done in GitHub itself, with the actions defined by us, or the extensive list of actions already available.
Ballerina has also implemented its own GitHub Action by allowing the Ballerina CLI commands to be accessible as an action. The Ballerina GitHub Action lives in this repo. You will be able…
Azure cloud provides a vast range of services that can be used to implement and deploy virtually any type of scenario. In this write up, I will explore the capabilities of scalable request processing of Azure cloud in conjunction with the Ballerina programming language.
Ballerina provides a natural approach for developing microservices and network-aware applications. This makes it an ideal choice to showcase the functionalities of Azure cloud. The following services of Azure cloud will be used:
Figure 01 shows the deployment diagram of…
Author of ‘Beginning Ballerina Programming’ | Software Developer | Evangelist | 🇱🇰 🇺🇸 | Working at WSO2 Inc. — @lafernando