Skip to main content
Version: LOC v0.6 (legacy)

API Route, MQ and Scheduler

Triggers - API route, MQ and scheduler - CLI commands.

API Route

loc apiroute|ar

API routes can be set with api-route-config.yaml in the project, which defines the URL path that would be link to one or more data processes.

Deploy an API Route

loc ar deploy -f <api-route-config>.yaml

The pid field in the YAML file must be set to a deployed data process's ID.

  • -f: API route YAML file (required)
tip

You can deploy an API route automatically along with a data process. See Deploy a Project.

List All API Routes

loc ar list

Inspect an API Route

loc ar get <id> -v

Delete an API Route

loc ar delete <id>

Message Queue

loc messagequeue|mq

MQ sources can be set with MQ client YAML file, which defines the MQ client type, host and port. Both MQ publisher and MQ subscriber connect a MQ client with one or more data processes.

Generate MQ Client YAML File

loc mq client init [output]
  • output: output file path and name (default: message-queue-client.yaml)

Generate MQ Subscriber YAML File

loc mq sub init [output]
  • output: output file path and name (default: subscriber.yaml)

clientId in the file must be a deployed MQ client's ID.

Generate MQ Publisher YAML File

loc mq pub init [output]
  • output: output file path and name (default: publisher.yaml)

clientId in the file must be a deployed MQ client's ID.

Common MQ Commands

Deploy a MQ Asset

loc mq client|pub|sub deploy -f <mq-file>.yaml

If one MQ assets with the same name exists, it will be updated.

  • -f: MQ client/publisher/subscriber YAML file (required)

List All MQ Assets

loc mq client|pub|sub list

Inspect a MQ Assets

loc mq client|pub|sub get <id> -v

Delete a MQ Assets

loc mq client|pub|sub delete <id>

Scheduler

loc scheduler|s

A scheduler can be set with a scheduled job YAML file, which use a trigger (schedule) on one or more data processes.

info

The term trigger is a bit confusing since we've already calling API routes, MQs and schedulers as triggers. The schedule trigger will be officially renamed to schedule at next release.

Generate Schedule Trigger YAML File

loc s t init [-c|-t|-w] [output]

It can be specified as one of the following trigger/schedule type:

  • -c: a Cron Job type trigger/schedule (default if no flag provided)
  • -t: a TimeUnit type trigger/schedule
  • -w: a Windowed TimeUnit type trigger/schedule (TimeUnit plus startTimeOfDay and endTimeOfDay)
  • output: output file path and name (default: trigger.yaml)

For a Cron job type schedule, the Cron expression has to have at least six fields.

Generate Scheduled job YAML File

loc s sj init
  • output: output file path and name (default: scheduled-job.yaml)

triggerId in the file must be a deployed trigger/schedule's ID and pid set to a deployed data process' PID.

Common Scheduler Commands

Deploy a Schedule Trigger/Scheduler Job

loc s t|sj deploy -f <scheduler-file>.yaml
  • -f: trigger YAML file (required)
note

If a trigger/schedule with the same name already exists, the description, endTime and startTime fields will be updated - but not the trigger/schedule type or time interval.

In other words, you need to manually deploy a new trigger/schedule if you want to change the triggering schedule.

List All Schedule Triggers/Scheduler Jobs

loc s t|sj list

Inspect a Schedule Trigger/Scheduler Job

loc s t|sj get <id> -v

Delete a Schedule Trigger/Scheduler Job

loc s t|sj delete <id>

Be noted that if a trigger/schedule is in use by a scheduled job, the scheduled job will be deleted as well.