Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda