Back to EIP

PatternMessage store captures information about each message in a central location.
How Ballerina helps

Ballerina can send messages to multiple channels during a single service invocation. Ballerina's concurrency model helps to send messages asynchronously without blocking the main channel. The wildcard binding pattern is used to indicate a 'fire-and-forget' invocation, where the response is not used.

Message StoreMessage ChannelWire TapMessage EndpointMessage
import ballerina/http;

type GeoCodeResponse record {|
    json results;

final http:Client geoCodingClient = check new ("");
final http:Client firebaseClient = check new ("");

service /api on new http:Listener(8080) {
    resource function get location(string address) returns GeoCodeResponse|error {
        GeoCodeResponse|error storedGeocode = firebaseClient->/location/[address]/location\.json();
        if storedGeocode !is error {
            return storedGeocode;
        GeoCodeResponse geocode = check geoCodingClient->/maps/api/geocode/'json(place=address);
        var _ = start storeAddress(address, geocode);
        return geocode;

function storeAddress(string address, GeoCodeResponse geocode) returns error? {
    _ = check firebaseClient->/location/[address]/location\.json.put(geocode, targetType = json);