Writing a workflow with activity code in Java & Golang

Is it possible to write a workflow in temporal where some activities are written in Java while others in Golang?
I am initiating the workflow in Java code, workflow code itself is written using Java SDK, however workflow activities are written in Golang. Is there an example that illustrates a similar setup ?

1 Like

We definitely need to write such a sample. In the meantime, you have to do it yourself.

  • Make sure that both Java and Go workers share the same domain (this is not a hard requirement, but simplifies things).
  • Make sure that Go and Java workers are using different task queue names to route tasks appropriately.
  • You can either create Java activities interface that mirrors Go activities signatures or use non strongly typed ActivityStub interface to invoke them directly by name.
  • When initializing activity stub pass Go task queue name to it as an option.

Something like:

    ActivityOptions options =
   ActivityStub goActivities = Workflow.newUntypedActivityStub(options);
   String result = goActivities.execute("MyGoActivity1", String.class, arg1, arg2);
1 Like