Ballerina Platform Documentation

repository·master·Indexed 41 days ago

https://github.com/ballerina-platform/ballerina-dev-website

Documentation for the Ballerina programming language, featuring coding conventions for version 1.2, guides on Enterprise Integration Patterns (EIP) such as Publish-Subscribe and Selective Consumer, and case studies on event-driven integration using the websubhub package and healthcare data transformation.

Tokens
295.6K
Snippets
929
Records
1.2K
Agent score
48%

What's inside Ballerina

  1. Overview of the Ballerina Tool (bal CLI)

    master

    The Ballerina Tool (bal) is the primary command-line interface for managing Ballerina source code. It is used for managing packages and modules, testing, building, and running programs. Additionally, it allows you to install, update, and switch between different Ballerina distributions.

    To see a full list of available commands, run bal help.

    $ bal help
  2. Overview of the Ballerina FTP Library

    master

    The Ballerina FTP library provides standard library functionalities for interacting with FTP and SFTP servers. It is designed to allow developers to send and receive files securely using either the standard FTP protocol or the SSH-encrypted SFTP protocol.

    The library is built around two core APIs:

    1. ftp:Client: Used to connect to an FTP/SFTP server to perform file operations (e.g., uploading, downloading, or managing files).
    2. ftp:Listener: Used to monitor a remote FTP location and receive notifications when files are added or removed.
  3. Overview of the Ballerina WebSubHub Library

    master

    The websubhub standard library for Ballerina provides WebSub-compliant functionalities for implementing both hub and publisher roles.

    WebSub is a real-time content delivery protocol over HTTP(S) based on the PubSubHubbub specification. The library supports the three core roles defined by the protocol:

    • Publisher: Advertises a topic and hub URL on one or more resource URLs.
    • Subscriber: Discovers the hub and topic URL via a resource URL, subscribes to updates at the hub, and accepts content distribution requests.
    • Hub: Manages subscription requests and distributes content to subscribers when a corresponding topic URL is updated.

    Ballerina's implementation includes minor improvements to the original protocol to ensure a seamless developer experience.

  4. Overview of the ibmmq library

    master

    The ibm.ibmmq library for Ballerina allows applications to connect to an IBM MQ server to send and receive messages. It provides core abstractions for interacting with the messaging infrastructure:

    • ibmmq:QueueManager: Represents an IBM MQ queue manager, serving as the primary interface for establishing and controlling connections.
    • ibmmq:Queue: Represents an IBM MQ Queue client for interacting with specific queues.
    • ibmmq:Topic: Represents an IBM MQ Topic client for interacting with topics.
  5. Overview of the Ballerina MQTT Library

    master

    The Ballerina MQTT library provides support for the MQTTv5 protocol, allowing Ballerina applications to interact with an MQTT broker. It is designed for lightweight, publish-subscribe, machine-to-machine communication, making it suitable for resource-constrained environments like IoT.

    The library provides two core APIs:

    1. Client: Used to publish messages to the MQTT broker.
    2. Listener: Used to receive messages from the MQTT broker.
  6. Overview of Ballerina MQTT Library

    master

    The Ballerina MQTT library provides support for the MQTTv5 protocol, allowing Ballerina applications to interact with an MQTT broker. It is designed for lightweight, publish-subscribe, machine-to-machine communication, making it suitable for resource-constrained environments like IoT.

    The library provides two core APIs:

    • Client: Used to publish messages to the MQTT broker.
    • Listener: Used to receive messages from the MQTT broker.
  7. Explore Enterprise Integration Pattern (EIP) samples in Ballerina

    master
    The enterprise-integration-patterns directory contains practical implementation samples of various Enterprise Integration Patterns (EIP) using the Ballerina programming language. These samples demonstrate how to apply standard integration patterns (such as Content-Based Router, Splitter, Aggregator, etc.) within the Ballerina ecosystem to solve complex messaging and orchestration problems.
  8. New features in jBallerina 1.2.1

    master

    The jBallerina 1.2.1 patch release introduces several improvements across the language, standard library, development tools, and deployment capabilities:

    Language Improvements

    • Deprecation Support: Added support for deprecation annotations, function parameters, and object fields.
    • XML Validation: Added runtime validations to the XML attributes map.
    • Type Assignment: Added support for map to record assignment.

    Standard Library Updates

    • Kafka Module: Added support for Avro key serialization/deserialization in the ballerina/kafka module.
    • WebSocket Client: Added automatic failover support.
    • Mutual SSL: The base64-encoded end user certificate is now provided along with the mutual SSL status.

    Development Tools

    • Testerina: Added support for mocking object methods.
    • Bindgen: Added support for subtypes in Java.
    • Formatting: Added support for formatting of streams.
    • Reporting: Added code coverage reports.

    Deployment

    • Kubernetes ConfigMap/Secret: Added default permissions mode support for annotations.
    • Kubernetes Deployments/Jobs: Added node selector support for annotations.
  9. Case Study: Red Cross Sri Lanka Elixir Project

    master

    The Elixir project, initiated by the Red Cross Society of Sri Lanka (SLRCS), is a digital solution designed to coordinate medical needs, suppliers, and donor funding during a healthcare crisis. The project utilized a 3-tier architecture consisting of React-based frontends (Admin Portal and Donor Portal), REST APIs built with Ballerina, and an SQL database hosted on Microsoft Azure.

    Key technical components used:

    • Ballerina: Used for implementing REST APIs and cloud-native integration logic.
    • WSO2 Choreo: Used for hosting and deploying the Ballerina-based REST APIs.
    • WSO2 Asgardeo: Used for managing user authentication via configuration on the Choreo platform.
    • Microsoft Azure: Used for hosting the shared SQL database.

    This case study demonstrates Ballerina's suitability for rapid development, its ease of learning for new developers, and its effectiveness in handling data-centric tasks like JSON/CSV processing and SQL integration.

  10. Overview of the Ballerina Auth Library

    master

    The Ballerina Auth library is a standard library used for the authentication and authorization of listeners (inbound) and clients (outbound) across various protocols including HTTP, gRPC, GraphQL, WebSocket, and WebSub.

    Key concepts include:

    • Listener auth: Authenticates and authorizes inbound requests/messages regardless of the transport protocol.
    • Client auth: Enriches outbound requests/messages with authentication credentials.
    • Auth provider: The entity responsible for providing the implementation of authentication protocols.
    • Auth handler: The entity that manages API security by using provider APIs to process user credentials and configurations.
    • Declarative approach: A configuration-driven method for simple use cases where users provide settings without managing the underlying logic.
    • Imperative approach: A code-driven method for advanced use cases requiring custom authentication or authorization logic.
  11. Overview of WebSubHub roles

    master

    The WebSubHub library implements the WebSub protocol (an evolution of PubSubHubbub) for real-time content delivery over HTTP(S). It supports three primary roles:

    • Publisher: Advertises a topic and hub URL on one or more resource URLs.
    • Subscriber: Discovers the hub and topic URL from a resource URL, subscribes to updates at the hub, and accepts content distribution requests.
    • Hub: Manages subscription requests and distributes content to subscribers when a corresponding topic URL is updated.

    Ballerina's implementation includes minor improvements to the original protocol to enhance the developer experience.