MassTransit Bus Stop - Request Response via Messaging (RPC)
Вставка
- Опубліковано 28 лис 2024
- Can I use messaging for request response (RPC)? Sure, why not! In this interactive episode, Chris and Dru talk about request response, and go through a couple samples on how to use MassTransit to send requests, handle responses, and unit test those conversations.
MassTransit
Documentation: masstransit.io/
Discord: / discord
Connect with us on Twitter:
/ phatboyg
/ drusellers
Recently, I did confuse the request type for the response type. No message came through, but no errors. It took me a couple of hours to discover that. Then I just: "Damn how obvious"
Great video and great feature, thanks! Regarding sending requests over Saga/SM, what if I want to enable multiple clients to send me requests? will the response message be sent to all of them? how will MT know which client sent that specific request?
That depends, there is a RequestStateMachine in MassTransit that can track multiple requests and respond once the operation completes.
Thank you for Sharing video! Please can you share repo/video/info on Masstransit Request-Response with Generic Message Type also
I watched a couple of videos and most of them has vague comparison, like this one, about comparing something to a db call. In my opinion it is not a good and correct comparison. For instance in this video the comparison was 250 call/sec db call to 2500req/sec request, the 250 number derived from a single operation taking 4 ms, but no concurrency considered. But I guess the 2500 req/sec number is a statistic calculated from a benchmark in a 16-core 32 thread cpu using wall clock .Which in fact it did not took a second but in reality took AmountOfConcurrency x 1 second. For the simplicity lets say 32, so it took 32000 milliseconds to perform 2500 request, which resulting 12.8 ms per request. So the correct comparison should be 4ms for a db operation to 12.8 ms for a request, resulting a very different picture than you portray.
What is the best practice to cope with situations where we can have more than 3 semantic responses. Just live with MassTransit limitations?
PR's are accepted, but seriously, why so many different responses? Yes, No, Failure - what else is there? Yes, Yes sorta, Yes maybe? OMG NO? No chance? No how? I'd simplify your message model first, honestly.
I guess you would need to use something like OneOf and have one repsonse inside with a discriminator. Are coming from functional programming that you want this type of response? :)
Why you use "init" in contract models? I use only "get" in my project and it's work perfect.
System.Text.Json requires either `get` or `init` to properly serialize/deserialize a property. So typically a record with get;init; is recommended.