Annotation Interface Tracker


@Target(PARAMETER) @Retention(RUNTIME) @Documented public @interface Tracker
Annotation that binds a method parameter to a special tracker variable.

A common pattern in kOS is to perform an operation via endpoint, which then generates events via the message broker. This is commonly used to allow multiple clients to remain synchronized, as well as monitor progress of long-running processes. Sometimes there is a need to correlate those events with the endpoint that triggered them. This is done via a request parameter called "tracker", which provides a unique value that is then included in the event data. In kOS, there is a standard way to get access to the tracker using the @Tracker annotation. The example below includes a tracker, which is used to track progress of the pump operation.

Example

 
  @Controller("/api")
  public class MyController {

      @PostMapping("/api/pump/{pump}/start")
      public void startPump(@HandleVariable("pump") Pump pump, @Tracker tracker) {
          pumpService.start(pump, tracker);
      }
  }
 
 
Since:
1.0
Version:
2022-08-30