← Integration Academy

Production Pulse · 5 / 8

Require a monitoring connection

Declare the HTTP device the installer must bind, and scope the device policy to that logical requirement.

YOUR TASK

Make this happen

3 steps
  1. Require monitor_service with type protocol/http and optional = false.

  2. Include the requirement in the document’s resources.

  3. In policy.cococo, scope the statement to integration_resource_requirement.monitor_service.id, not "*".

This lesson starts with the previous working solution. Build and connect the next capability. Your earlier drafts are kept separately.

Read the starter files

main.cococo

integration_document "monitor" {
  integrationId = "com.academy.monitor"
  sdkVersion = "2.0"
  version = "1.0.0"
  description = "A small heartbeat integration"
  actor = integration_actor.monitor
}

actor.cococo

integration_actor "monitor" {
  subscriptions = [integration_actor_subscription.job_updates]
  actions = [integration_actor_action.status]
  timers = [integration_actor_timer.heartbeat, integration_actor_timer.daily_review]
}

timer.cococo

integration_actor_timer "heartbeat" {
  name = "heartbeat"
  schedule = { every = "5m" }
  jitter = "15s"
  source = "return { alive = true }"
}

events.cococo

integration_actor_subscription "job_updates" {
  topic = "job.updated"
  source = file("scripts/job-updated.lua")
}

actions.cococo

integration_actor_action "status" {
  name = "status"
  label = "Check production pulse"
  inputSchema = { type = "object", properties = {} }
  outputSchema = {
    type = "object"
    properties = { alive = { type = "boolean" } }
    required = ["alive"]
  }
  source = file("scripts/status.lua")
}

daily.cococo

integration_actor_timer "daily_review" {
  name = "daily_review"
  schedule = { cron = "0 6 * * *" }
  source = "return { review = true }"
}

resources.cococo

integration_resource_requirement "monitor_service" {
  id = "monitor_service"
  type = "protocol/http"
  # TODO: add optional — see the task above.
  # TODO: add description — see the task above.
}

policy.cococo

integration_policy_statement "devices" {
  # TODO: add effect — see the task above.
  # TODO: add actions — see the task above.
  # TODO: add resources — see the task above.
}

integration_policy "monitor" {
  # TODO: add statements — see the task above.
}
Supplied scripts and pinned contracts (read-only)

These fixtures explain the runtime behaviour being composed. They are included in validation but are not executed. The generated API definition is supplied, not an XML authoring task.

scripts/heartbeat.lua

return { alive = true }

scripts/job-updated.lua

local event, config = ...
return { reason = "job.updated" }

scripts/status.lua

local input, actionConfig = ...
return { alive = true }