January 2020
Intermediate to advanced
640 pages
16h 56m
English
As we saw in the previous section, we need to define an envelope message for worker payloads:
message WorkerPayload { oneof payload { Step step = 1; RelayMessage relay_message = 2; }}With the help of the oneof type, we can emulate a message union. A WorkerPayload can contain either a Step message or a RelayMessage message. The Step message is more interesting, so we will examine its definition first:
message Step { Type type = 1; map<string, google.protobuf.Any> aggregator_values = 2; int64 activeInStep = 3; enum Type { INVALID = 0; PRE = 1; POST = 2; POST_KEEP_RUNNING = 3; EXECUTED_GRAPH = 4; PESISTED_RESULTS = 5; COMPLETED_JOB = 6; }}The Step message will be sent by the worker ...