Add job_event and job_event_ack to the gateway protocol
A gateway keeps what happened to a job it was handed (started, finished, failed) and re-sends it on every connection until the cloud acknowledges it, so an outcome reached while the cloud was unreachable still arrives.
This commit is contained in:
@@ -316,6 +316,22 @@ export const EdgeClientMessageSchema = Type.Union([
|
||||
jpeg_base64: Maybe(Type.String()),
|
||||
error: Maybe(Type.String()),
|
||||
}),
|
||||
/**
|
||||
* What happened to a job the gateway was handed. Kept in the gateway's own
|
||||
* database and re-sent on every connection until answered with a
|
||||
* `job_event_ack`; the cloud applies it only to a job still in flight and
|
||||
* applying it twice changes nothing.
|
||||
*/
|
||||
Type.Object({
|
||||
type: Type.Literal("job_event"),
|
||||
event_id: Type.Integer(),
|
||||
job_id: Type.String({ format: "uuid" }),
|
||||
event: Type.Union([Type.Literal("started"), Type.Literal("finished"), Type.Literal("failed")]),
|
||||
/** For `failed`: the reason, in words for an operator. */
|
||||
detail: Maybe(Type.String()),
|
||||
/** When the gateway saw it, ms since the Unix epoch. */
|
||||
at_ms: Type.Integer(),
|
||||
}),
|
||||
Type.Object({
|
||||
type: Type.Literal("frame_batch"),
|
||||
printer_id: Type.String(),
|
||||
@@ -401,6 +417,14 @@ export const EdgeServerMessageSchema = Type.Union([
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
/** The cloud has dealt with a `job_event`; the gateway can forget it. */
|
||||
Type.Object(
|
||||
{
|
||||
type: Type.Literal("job_event_ack"),
|
||||
event_id: Type.Integer(),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
Type.Object({
|
||||
type: Type.Literal("command"),
|
||||
command_id: Type.String(),
|
||||
|
||||
Reference in New Issue
Block a user