Using protobuf for communication between java and typescript service

Hi Team, I am trying to use protobuf object for communication on client side (Java sdk) and the server side is implemented in typescript sdk
client side :

   WorkflowOptions options1 = WorkflowOptions.newBuilder().setWorkflowId(workflowId)
                    .setTaskQueue("planner").build();
            workflowClient = TemporalHelper.getWorkflowClient();
            WorkflowStub workflowStub = workflowClient.newUntypedWorkflowStub("getInfrastructureTemplate",
                    options1);
            WorkflowExecution execution = workflowStub.start(infrastructureRequest);
            var details = workflowStub.getResult(test.class);

server side :

export function getInfrastructureTemplate(productTemplate: any): any {
  // console.log(productTemplate);
  // const payload = defaultPayloadConverter.fromPayload(productTemplate);
  const testProto = test.create({test: "test1"});
  return payloadConverter.toPayload(testProto);
}

protobuff:

message test{
   string test:1;
}

test.class is the class generated from this test protobuf.
My assumption was since the server side is returning a protobuf conversion should be automatically done as in client side workflowStub.getResult(test.class);
I am expecting test protobuff only.But the code is throwing conversion exception. Is there any way I can handle this scenario?

Hello @Abu_Rahan

When you say that your server is written in Java, do you mean your worker?

Can you show the full exception log?

Antonio

Have you seen this topic about a similar problem?

2 Likes