No video

Lesson 137 - Rest vs. Messaging

  Рет қаралды 9,481

Mark Richards

Mark Richards

Күн бұрын

Developers and architects are often faced with the age-old question: Should I use REST or messaging for my communication protocol? More appropriately, this question becomes more about whether to use synchronous or asynchronous communication. In this lesson Mark Richards discusses some of the trade-offs and implications of each of these communication styles to help you decide which one is most appropriate for your situation.
Reference Links:
Software Architecture Monday: bit.ly/3dadEe3
Fundamentals of Software Architecture: amzn.to/3rgFLjY
Software Architecture: The Hard Parts: amzn.to/3BjMMF2

Пікірлер: 18
@farrukhijaz
@farrukhijaz 2 жыл бұрын
Great video as always! Up to the Mark :)
@stjepankarin
@stjepankarin 2 жыл бұрын
Thanks for the nice video. As always, it depends on tradeoffs you want/need to choose for whatever use-case that needs to be supported. Regarding wishlist/catalogue example, and given we’re ok with eventual consistency, I would consider storing all necessary data needed for it to function as needed in a db belonging to the wishlist. That part should of course be more of read-mode, as catalogue is considered to be “master”-data in this case. Anytime a product in catalogue would update, I would make sure that ProductUpdated event ends up as a message on a bus, and then wishlist (and whoever else needed) could pick it up and update its data accordingly. Maybe that is what you’re also trying to explain in your east-west communication analogy? I do see by the graphics, that both have their own dbs/tables.
@staskrakovsky9872
@staskrakovsky9872 Жыл бұрын
Awesome lesson!
@GauravSehrawat8888
@GauravSehrawat8888 4 ай бұрын
Dankejewel van Amsterdam
@nullentrophy
@nullentrophy 2 жыл бұрын
Thank you sir
@matthiashjalmarsson4121
@matthiashjalmarsson4121 2 жыл бұрын
In your last example with Wishlist and Catalog, wouldn't the request to the Catalog be synchronous? Surely Wishlist service has to block until the response has been received. So I'm not really sure what "messaging" provides in this context. Couldn't the Private API be REST as well? Or is the overall argument that it's easier and quicker to implement and maintain a private api over messaging?
@markrichards5014
@markrichards5014 2 жыл бұрын
It's more the latter (easier with messaging). Private REST API's are hard to govern and are more costly. Furthermore, with the request/reply, Wishlist can do work while the catalog is retrieving its information (similar to how futures/promises work in non-messing pseudo-sync situations)
@markrichards5014
@markrichards5014 2 жыл бұрын
@Krishna Gogineni See lesson 1...
@rishabmanocha5732
@rishabmanocha5732 2 жыл бұрын
Could you give feedback if this would instead be a more valid solution? The Product service can broadcasts the added/updated product payload to the message queue everytime a PUT/POST call is made to it. The wishlist service listening to this will persist the description field that it needs from that payload and will never have a request-time dependency on the product service being available? Curious to know if there's a drawback to this approach?
@berntrune
@berntrune Жыл бұрын
Thanks again for a great video. Of course it depends, but would you normally use rest between an orchistrator service and the downstream services, due to the north/south "rule"?
@markrichards5014
@markrichards5014 Жыл бұрын
Once you reach an orchestration service, the "north south" communication stops and the "east west" begins, so no, I would not normally use rest (again, as you said, it depends...).
@razean22
@razean22 2 жыл бұрын
Interesting, an introduction to what you mean by asynchronous and synchronous would have been nice though. It seems that in the context of this video they are very different from what they are in a programming (let's say Promises in JS or async in python)
@markrichards5014
@markrichards5014 2 жыл бұрын
Good point; request/reply messaging is not really "asynchronous communication" because I have to wait for the response before continuing. With true async, I don't have to wait; I can respond to the user, and if needed, wait for a response on a separate message challen without having the make the user wait.
@zaytsevand
@zaytsevand 2 жыл бұрын
👍 actually, that's pretty good observation. With async in programming languages we've often get a state machine managed by the execution environment. In the async communication that state machine is often overlooked, nevertheless should also be present, but it's up for us to implement it
@HiOctaneVideoShare
@HiOctaneVideoShare Жыл бұрын
Wait, how does messaging creatre "private api"? And how does this "private api" created by messaging know which fields to message back to Whishlist Service?
@markrichards5014
@markrichards5014 Жыл бұрын
The "private API" is formed beneath the public API gateway by having services communicate through messaging. It's private because the messaging endpoints are not made available to the public - only internal services know about these from an inter-service communication perspective.
@CrownlessX
@CrownlessX 3 ай бұрын
Why not gRPC instead of REST?
@markrichards5014
@markrichards5014 3 ай бұрын
gRPC is a point-to-point persistent http2 connection using protocol buffers. While it is significantly faster than REST, it unfortunately couples services together because it is an RPC call (IOW using stubs). Also, gRPC alone doesn't support load balancing-you would need to use gRPC-LB instead.
Lesson 136 - Managing Shared Database Changes
8:52
Mark Richards
Рет қаралды 4,2 М.
Lesson 175 - Events vs Messages
10:04
Mark Richards
Рет қаралды 6 М.
👨‍🔧📐
00:43
Kan Andrey
Рет қаралды 7 МЛН
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 14 МЛН
Lesson 110 - The Pros and Cons of Event Driven Architecture
11:08
Mark Richards
Рет қаралды 9 М.
Lesson 74 - Elephant Migration AntiPattern
6:55
Mark Richards
Рет қаралды 5 М.
Lesson126 - Is SOA Dead?
11:35
Mark Richards
Рет қаралды 6 М.
Enterprise Architecture Vs. Solution Architecture
20:30
Enterprise Architecture Radio
Рет қаралды 6 М.
Lesson 145 - Analyzing Tradeoffs
7:54
Mark Richards
Рет қаралды 11 М.
Lesson 153 - Service Based vs SOA
10:14
Mark Richards
Рет қаралды 5 М.
Lesson 85 - Defining Scalability and Elasticity
15:15
Mark Richards
Рет қаралды 4,3 М.
Lesson 109 - BASE Transactions and Eventual Consistency
10:50
Mark Richards
Рет қаралды 4,8 М.
👨‍🔧📐
00:43
Kan Andrey
Рет қаралды 7 МЛН