Distributed Activities invoking from same workflow

I am new to Temporal and I have order application implementation where there is workflow(microservice) and there are various activities(microservices) which are invoked from the workflow service as shown below.

Problem:

  1. Is this right expectation to have shared activity, if yes then how do I register activities? ( I get error if I do as below on same queue for all activities associated with a WF in a namespace)

microservice 1.1

Worker worker = factory.newWorker("OrderQueue");
   worker.registerWorkflowImplementationTypes(Workflow1.class, Workflow2.class, ChildWorkflow.class );

microservice 1.2

Worker worker = factory.newWorker("OrderQueue");
        worker.registerActivitiesImplementations(activity<1&2>, activity3);

shared microservice 1.3

Worker worker = factory.getWorker("OrderQueue");
 worker.registerActivitiesImplementations(activity4);
  1. Is it right expectation to have WF and Activities in different services at all? If yes then how to perform unit testing on standalone activities? since I don’t get WF implementation class in standalone activity.

To invoke an activity or a child workflow, you need only their interface, not their implementation. So there is no need to register an activity or child workflow implementation with a worker that implements a workflow that calls it. It is also possible to call an activity or a child workflow by its string name if you want to avoid sharing any code.

Each service should listen to a different task queue. In the code snippets you posted, all the services listen to the same task queue, which is not going to work.

When creating the correspondent stub, You must specify the correct task queue using ActivityOptioins and the ChildWorkflowOptions.

BTW the diagram shows an activity creating a child workflow. Only workflows can create child workflows.