Swan Lake Beta2 is here.
import ballerina/http;
import ballerina/io;

// A function can be viewed as a sequence diagram.
// The diagram has a lifeline (vertical line) for each worker (both named 
// worker and function's default worker).
public function main() returns error? {
    // The diagram also has a lifeline for each client object parameter or variable in 
    // the initialization section, representing the remote system to which the client  
    // object is sending messages.
    http:Client cl = check new ("https://www.mocky.io");

    // Each remote method call on a client object is represented as a horizontal line
    // between the lifeline of the worker making the call and the remote system.
    string payload = check cl->get("/v2/5ae082123200006b00510c3d/");

    io:println(payload);
}

Sequence Diagrams

A function can be viewed as a sequence diagram as shown below.

Sequence Diagrams

The diagram has a lifeline (vertical line) for each worker (both named worker and function’s default worker). The diagram also has a lifeline for each client object parameter or variable in the initialization section, representing the remote system to which the client object is sending messages. Each remote method call on a client object is represented as a horizontal line between the lifeline of the worker making the call and the remote system.

import ballerina/http;
import ballerina/io;
public function main() returns error? {

A function can be viewed as a sequence diagram. The diagram has a lifeline (vertical line) for each worker (both named worker and function’s default worker).

    http:Client cl = check new ("https://www.mocky.io");

The diagram also has a lifeline for each client object parameter or variable in the initialization section, representing the remote system to which the client
object is sending messages.

    string payload = check cl->get("/v2/5ae082123200006b00510c3d/");

Each remote method call on a client object is represented as a horizontal line between the lifeline of the worker making the call and the remote system.

    io:println(payload);
}
bal run sequence_diagrams.bal
Hello World
import ballerina/http;
import ballerina/io;

// A function can be viewed as a sequence diagram.
// The diagram has a lifeline (vertical line) for each worker (both named 
// worker and function's default worker).
public function main() returns error? {
    // The diagram also has a lifeline for each client object parameter or variable in 
    // the initialization section, representing the remote system to which the client  
    // object is sending messages.
    http:Client cl = check new ("https://www.mocky.io");

    // Each remote method call on a client object is represented as a horizontal line
    // between the lifeline of the worker making the call and the remote system.
    string payload = check cl->get("/v2/5ae082123200006b00510c3d/");

    io:println(payload);
}

Sequence Diagrams

A function can be viewed as a sequence diagram as shown below.

Sequence Diagrams

The diagram has a lifeline (vertical line) for each worker (both named worker and function’s default worker). The diagram also has a lifeline for each client object parameter or variable in the initialization section, representing the remote system to which the client object is sending messages. Each remote method call on a client object is represented as a horizontal line between the lifeline of the worker making the call and the remote system.

import ballerina/http;
import ballerina/io;
public function main() returns error? {

A function can be viewed as a sequence diagram. The diagram has a lifeline (vertical line) for each worker (both named worker and function’s default worker).

    http:Client cl = check new ("https://www.mocky.io");

The diagram also has a lifeline for each client object parameter or variable in the initialization section, representing the remote system to which the client
object is sending messages.

    string payload = check cl->get("/v2/5ae082123200006b00510c3d/");

Each remote method call on a client object is represented as a horizontal line between the lifeline of the worker making the call and the remote system.

    io:println(payload);
}
bal run sequence_diagrams.bal
Hello World

In the creation of Ballerina, we were inspired by so many technologies. Thank you to all that have come before us (and forgive us if we missed one): Java, Go, C, C++, D, Rust, Haskell, Kotlin, Dart, TypeScript, JavaScript, Python, Perl, Flow, Swift, Elm, RelaxNG, NPM, Crates, Maven, Gradle, Kubernetes, Docker, Envoy, Markdown, GitHub and WSO2.

Cookie Policy

This website uses cookies so that we can provide you with the best user experience. Read our Cookie Policy to find out more.

If you wish to disable cookies you can do so from your browser.

I Understand