Send protobuf payload from Typescript to Java and reverse

Hi Temporal!

I’m trying to understand how to send a payload between Typescript SDK and JAVA.

I succeeded to run the workers and the workflows in both sides, so there is a connection between the projects.

In Typescript I tried to use several ways as you can see below.
I don’t know what is the proper way to send it from Typescript and the proper way to get it in JAVA and the reverse way also: JAVA to Typescript.

I tried the following:

I used protobufjs to generate protobuf and then I created a proto and send it as is.

 const testProto = test.create({test: "test1"});
 return testProto;

Then I tried to use the default converter like that:

 return defaultPayloadConverter.toPayload(testProto );

And also used custom payload converter with protobuf as you showed in you protobuf example in typescript-samples app:

 return payloadConverter.toPayload({test: "test1"});

I tried with plain object and also protobuf.

I see the conversion in the logs but in Java I got an error.

what should I do?
what is the proper way to send payloads between those two languages using Temporal?
should I use a regular JSON?
How to send payload from JAVA to Typescript? How do I need to handle this payload in Typescript?

The TypeScript SDK has a built-in protobuf payload converter, you’ll need to install that in your worker and client:

See also this doc in the repo: sdk-typescript/protobuf-libraries.md at main · temporalio/sdk-typescript · GitHub

1 Like

Thank you very much!