Anatomy of Trillo Function

Anatomy of Trillo Function is repeated here for convenience. It is covered at other places such as Trillo Workbench Developer Guide.

Each Trillo Function has the following structures. Each method corresponds to one endpoint. You can add new methods or remove methods that are not needed. A function can be given any meaningful name. Similarly a method can be given any name. For example a function called AccountService may have a method called “makePayment”. By convention, its endpoint will be, /ds/function/shared/AccountService/makePayment.

import java.util.Map;
import com.collager.trillo.util.Api;
import com.collager.trillo.util.ServerlessFunction;

public class MyFunction extends ServerlessFunction {

  @Api(httpMethod="post")
  public Object saveValue(Map<String, Object> parameters) {
    return parameters;
  }
  
  @Api(httpMethod="put")
  public Object updateValue(Map<String, Object> parameters) {
    return parameters;
  }
  
  @Api(httpMethod="get")
  public Object getValue(Map<String, Object> parameters) {
    return parameters;
  }
  
  @Api(httpMethod="delete")
  public Object removeOverheads(Map<String, Object> parameters) {
    return parameters;
  }

}

In the following exercises, we will repeat similar code for lessons without a discussion of the above structure. It will be obvious.

The following constructs are useful and described in the append below.

Last updated