Sending proto messages directly over signal channels

Is it possible to send proto messages directly as signals?

Attempting the following:

msg := &pb.MyMessage{
  Id: "id-1234",
}

err := c.SignalWorkflow(ctx, "workflow-id-1", "", "messages", msg)

The dashboard shows:

I’m also noticing the worker is logging an error:

2020/08/12 16:31:11 INFO  No logger configured for temporal client. Created default one.
2020/08/12 16:31:12 INFO  No activities registered. Skipping activity worker start Namespace default TaskQueue any WorkerID 1118133@beast-ubuntu@
2020/08/12 16:31:12 INFO  Started Worker Namespace default TaskQueue any WorkerID 1118133@beast-ubuntu@
2020/08/12 16:31:12 INFO  workflow started Namespace default TaskQueue any WorkerID 1118133@beast-ubuntu@ WorkflowType MyWorkflow WorkflowID dbcc7e11-2797-42cc-a423-846437fac710 RunID de74233b-c0e5-4406-a953-dbe311a33c0c
2020/08/12 16:34:01 ERROR Corrupt signal received on channel . Error deserializing Namespace default TaskQueue any WorkerID 1118133@beast-ubuntu@ WorkflowType MyWorkflow WorkflowID dbcc7e11-2797-42cc-a423-846437fac710 RunID de74233b-c0e5-4406-a953-dbe311a33c0c Error payload item 0: value: {{{} [] [] <nil>} 0 []    <nil> <nil>} of type: reflect.Value: value doesn't implement proto.Message

I have verified that the generated MyMessage does implement the 3 methods required of gogo’s proto.Message interface.

Any ideas?

1 Like

Sorry for delay, Paul. How do you read the signal? It seems that you use wrong type to read signal data. This code works for me:

	wt := &commonpb.WorkflowType{Name: "workflow-type"}
	err = client.SignalWorkflow(ctx, "test-signal-workflow", run.GetRunID(), "proto-signal", wt)

and on workflow side:

	protoSignalChan := workflow.GetSignalChannel(ctx, "proto-signal")
	var protoSignalValue *commonpb.WorkflowType
	s.AddReceive(protoSignalChan, func(c workflow.ReceiveChannel, more bool) {
		c.Receive(ctx, &protoSignalValue)
		workflow.GetLogger(ctx).Info("Received signal", "signal", "proto-signal", "value", protoSignalValue)
	})
	s.Select(ctx)

I am adding integration test for SignalWorkflow: https://github.com/temporalio/go-sdk/pull/235.