sdk-go icon indicating copy to clipboard operation
sdk-go copied to clipboard

How to return `[]*proto.Message` from an activity?

Open johanforssell opened this issue 3 years ago • 0 comments

I'm thinking that I've missed something important in dealing with Protobuffers, rather than how Temporal works. I just want to hear if anybody here knows of this issue.

Expected Behavior

events := make([]*pb.SparkpostEvent, 0)
workflow.ExecuteActivity(context, (*activities.Activities).Unmarshal, data).Get(context, &events)

events should now be a slice of *pb.SparkpostEvent, with all levels of protobuf messages below it Like so:

[
  SparkpostEvent { 
    Msys { 
      track_event { ... } 
    } 
  }, 
  SparkpostEvent{...}, 
  ...
]

Actual Behavior

The events slice contains all the root level protobuffers but the children are missing.

I have an array of SparkpostEvents, but Msys is just nil.

Steps to Reproduce the Problem

  1. Create a protobuffer message a couple of levels deep
  2. Return an array of them from .Get()

Specifications

  • Version:
    • go.temporal.io/api v1.4.1-0.20210429213054-a9a257b5cf16
    • go.temporal.io/sdk v1.6.0
  • Platform: M1 Mac

johanforssell avatar Jun 03 '21 11:06 johanforssell