Hi,
I have a current micro-srv implementation decoupled by RabbitMq and I want to move to Temporal implementation.
My tech stack is Python and Node currently deployed to a different kind of OS (docker images).
What is not very clear to me is how to register each activity (or several) to different microservices using the Python or Node SDK, without decoupling the code between services (library etc.)
I tried to follow this thread (springboot-microservices) , which seems to try achieving the same goal, but in the end I couldn’t implement it in python or node (maybe because the java api is a bit different).
So for example, here is a very simple workflow:
@workflow.defn
class SayHello:
@workflow.run
async def run(self, name: str) -> str:
hi = await workflow.execute_activity(
"say_hello", name, schedule_to_close_timeout=timedelta(seconds=5)
)
by = await workflow.execute_activity(
"say_by", name, schedule_to_close_timeout=timedelta(seconds=5)
)
return hi + by
And these are the activities:
@activity.defn
async def say_hello(name: str) -> str:
# I will run on linux server
return f"Hello, {name}!"
@activity.defn
async def say_by(name: str) -> str:
# I will run on Unix server
return f"Byby, {name}!"
So, if I understand correctly I should have in each service a worker that handle different activity:
client = await Client.connect("localhost:7233")
worker = Worker(
client,
task_queue="my-task-queue",
workflows=[SayHello],
activities=[say_hello],
)
await worker.run()
But when I run it I get the following error:
Activity function say_by is not registered on this worker, available activities: say_hello …
I guess there should be a service that runs only the workflow regardless of the activities (same as the diagram below) what am I missing? will be glad to get directions and the right way to implement it.
Thanks.