-
Notifications
You must be signed in to change notification settings - Fork 77
Enable Native Dapr Workflows with Message Router Decorators #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Native Dapr Workflows with Message Router Decorators #233
Conversation
Signed-off-by: Roberto Rodriguez <[email protected]>
Signed-off-by: Roberto Rodriguez <[email protected]>
Signed-off-by: Roberto Rodriguez <[email protected]>
Signed-off-by: Roberto Rodriguez <[email protected]>
Signed-off-by: Roberto Rodriguez <[email protected]>
Signed-off-by: Roberto Rodriguez <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a great addition to simplify things and support a more python-native decorator approach to handle pubsub messages and trigger workflows!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
IMO, In addition to declarative, programatic, and streaming subscriptions, the Message Router is another (4th) type of subscribing to a topic. It is probably the most pythonic version among all.
-
Is there anything specific to DaprAgents or can message router be even at python sdk?
-
I love this feature, just not sure where it fits best (DA or Python SDK) and what to call it? There is already the concept of subscription, and @app.route in python sdk
|
Isn't this the way to create a streaming consumer?
There is no extra time requirement, but we have to make sure:
|
that is not enough subscription = client.subscribe(
pubsub_name='pubsub', topic='orders', dead_letter_topic='orders_dead'
)We need to map it to a handler which can be done with close_fn = client.subscribe_with_handler(
pubsub_name='pubsub', topic='orders', handler_fn=process_message,
dead_letter_topic='orders_dead'
)But once again, that is not enough, the "handler_fun" in our project would point to a Dapr Workflow script which would need to be run using a dapr workflow client. Therefore, we need to create that abstraction so that we can use it on our DurableAgent or Orchestrator class which rely on a |
|
Thanks for the explanation @Cyb3rWard0g, I see why is this needed. |
…' into cyb3rward0g/new-message-router Signed-off-by: Roberto Rodriguez <[email protected]>
Yes, dapr agents is the place for this for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a few tests pls and then this is g2g 🙌
…' into cyb3rward0g/new-message-router Signed-off-by: Roberto Rodriguez <[email protected]>
Signed-off-by: Roberto Rodriguez <[email protected]>
This PR Depends on #232
Overview
This PR introduces a new
@message_routerdecorator that enables native Dapr workflow orchestration triggered directly from Pub/Sub messages without relying on legacy Dapr Agents abstractions. Developers now have full control over the Dapr Workflow runtime and Pub/Sub client, allowing workflows and LLM/Agent activities to be registered, composed, and executed using the official Dapr APIs.This update modernizes the message routing layer to align with Dapr’s workflow primitives, improving transparency, flexibility, and maintainability.
Key Changes
decorators/routers.py@message_routerdecorator for schema-aware message routingWorkflowRuntimeand DaprClient lifecycleutils/routers.py: message extraction, validation, and CloudEvent parsing helpersutils/registration.py:register_message_handlers()for runtime subscription via the active DaprClientdecorators/messaging.pyMessage Router WorkflowQuickstartmessage_client.pypublisher and updated README with full configurationMessage Router Workflowalongside LLM- and Agent-based patterns