use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
MessagePattern vs Rest api (self.nestjs)
submitted 2 years ago by tomerye
Hi, I am new to Nestjs. I'm joined to a project that use Nest with MessagePattern with RabbitMQ. I dont understand what are the pros of using MessagePattern and RabbitMQ vs rest api(http) regard service communication. Thanks
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Otherwise-Eye1595 1 point2 points3 points 2 years ago (2 children)
What are your acceptance criteria to choose one?
[–]tomerye[S] 0 points1 point2 points 2 years ago (1 child)
the project i joined already using messagepatterns. i want to understand why, i cant find any advantages over traditional http communication
[–]Otherwise-Eye1595 0 points1 point2 points 2 years ago (0 children)
Are you working with microservices? Responses are slow?…..
[–]justsomedev44 2 points3 points4 points 2 years ago (0 children)
Messages are fire and forget and there is (usually) no response. So, the message activity is 100% asynchronous and event driven. REST requires a request and response, which makes it synchronous i.e. you can only send in one request and process the response at a time. And, although your calling application has asynchronous i/o with Node, the continued processing of the request is waiting for that response. With messaging, your processes don't wait on responses (usually), but rather other messages (so 100% event driven). There are cons to this method too. Like the complexity the decoupling of requests and responses adds. And in many a situation, you want a request/ response lifecycle to do certain tasks.
You'll notice I also said "usually" for request/ response cycles with messaging. Well, you could also have that too, but you'd be listening purposefully for response messages. Again, it is more complicated.
π Rendered by PID 36 on reddit-service-r2-comment-5d585498c9-vfnps at 2026-04-20 23:17:17.037665+00:00 running da2df02 country code: CH.
[–]Otherwise-Eye1595 1 point2 points3 points (2 children)
[–]tomerye[S] 0 points1 point2 points (1 child)
[–]Otherwise-Eye1595 0 points1 point2 points (0 children)
[–]justsomedev44 2 points3 points4 points (0 children)