Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Establishing protocol buffer definitions for worker payloads

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content