Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
how can set result for counsme in rabitmq and nodejs

i have two service and i created that with nodejs and typescript .

i want to send and recive message between these two services with reabitMQ .

i do it with this code :

Publisher :

await MessageBroker.Publish('coin', 'transaction', {
            type: MessageBrokerType.Transfer,
            to: 'to',
            amount: amount
});

Consume :

MessageBroker.channel.consume(exchange + '.' + queue, async (msg: any) => {

    const { to, amount , type } = JSON.parse(msg.content);

    const transfer = await UnitOfWork.coinRepository.transfer(to, amount);
    console.log(to, amount);
})

it's worked and send message from publisher to consume but i have a problem .

i need to set result for consume and send it for publisher .

for exmaple maybe i have a problem in this line UnitOfWork.coinRepository.transfer(to, amount); and i should send to publisher error message and if operation sucess send message to subscriber about success result .

now how can i solve this problem and set result for message between two service ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

What you have done so far is implementation of pub/sub with RabbitMQ and what you need to do is to setup a message-driven architecture (RPC).

This document clarifies what you need to do perfectly for an RPC pattern:

https://www.rabbitmq.com/tutorials/tutorial-six-javascript.html

The examples are written in Js but you can surely change them to Typescript.

Message-Driven will be handled by correlationId which is used to correlate RPC responses with requests, that's what you need to implement, more information can be found in the document. At the end of day if you weren't successful implementing it, ask me for a real sample with Typescript.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!