Skip to content
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

Dapr Pub/Sub. Sending messages with specific fifoMessageGroupID #3415

Open
YuryZevakin opened this issue May 13, 2024 · 3 comments
Open

Dapr Pub/Sub. Sending messages with specific fifoMessageGroupID #3415

YuryZevakin opened this issue May 13, 2024 · 3 comments
Labels
good first issue Good for newcomers
Milestone

Comments

@YuryZevakin
Copy link

YuryZevakin commented May 13, 2024

Hello Guys, Thank you for DAPR. It helps a lot.

We are using AWS SNS/SQS pubsub in FIFIO mode and we want to set fifoMessageGroupID for each message we are sending.
I have read Dapr.Client PublishEventAsync specification (for .net).
Can we set fifoMessageGroupID in the parameters of PublishEventAsync?

Thank you in advance for your answer.

@yaron2 yaron2 transferred this issue from dapr/dapr May 13, 2024
@yaron2 yaron2 added this to the v1.14 milestone May 13, 2024
@yaron2 yaron2 added the good first issue Good for newcomers label May 13, 2024
@yaron2
Copy link
Member

yaron2 commented May 13, 2024

Moved this to the correct repository.

Can we set fifoMessageGroupID in the parameters of PublishEventAsync?

This is currently not supported. You can only set fifoMessageGroupID on the metadata, otherwise Dapr generates its own group ID for the message. I've triaged this into 1.14 as it should be easy to add.

@YuryZevakin
Copy link
Author

Why is the ability to set fifoMessageGroupID when sending pub/sub messages important?

Background

we have an inventory system that is implemented according to the microservice architecture pattern and our microservices can communicate with each other with pub/sub pattern powered by DAPR.
Each microservice has its own database and is responsible for its bounding context of the business domain.

As a result, we have a distributed system and we are working to reach the highest level of system consistency.

The most important tool to reach eventual consistency is by using FIFO queues in pubsub communications to make sure that all system operations will be processed in the system in the correct order.
It is important to note that we have multitenancy in the system and many customers can use the system API in parallel.

AND

in the case of using FIFO all our customers currently are in one queue. And high load of one customer affects the work of another customer because the queue is FIFO and all messages will be processed in strict order. Horizontal scaling of microservices is useless in this case.

Proposes solution.

If we could set fifoMessageGroupID as customer Id, then processing to queues for different customers can performed in parallel. Horizontal scaling of microservices will work well and a high load of one customer will not affect to work of another customer in the multitenant system.

Workaround

Currently, we have a workaround, how to split processing to different customers with different FIFO, but is not as elegant as fifoMessageGroupID approach.

@YuryZevakin
Copy link
Author

YuryZevakin commented May 15, 2024

Thank you @yaron2 for a tip.
I have set fifoMessageGroupID on the metadata.

var metaData = new Dictionary<string, string>();
metaData.Add("fifo", "true");
metaData.Add("fifoMessageGroupID", customerId);
_client.PublishEventAsync(pubsubName, topicName, data, metaData, cancellationToken);

I don't know Is it corrent way to set it so?
Please advise me on how we can check fifoMessageGroupID was updated in SNS/SQS?
Can i see it in some DAPR logs?

Thank you in advance.

@berndverst berndverst modified the milestones: v1.14, v1.15 Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants