Giter VIP home page Giter VIP logo

Comments (3)

p-fedyukovich avatar p-fedyukovich commented on June 19, 2024 1

In an architecture where i have multiple replicas of an http-server and multiple replicas of a microservice.

Say that each http server gets a request via REST and send a message to a microservice to perform a task and waits for its response. How would you go about it using this lib as a transport?

specifically - if there are multiple http server clients that send messages to the microservices- how do i know that the same http-server that sends a message also gets the response and not the other http-server replica?

do i need to have a unique replyTopice / replySubscription per http-service (aka the publishing client)?

Just checked the code and probably response message might be lost. I will explain: when client sends a message to microservice it generates unique id and stores with a message callback which is supposed to be executed once response message is received. If you have multiple client in this case response might be delivered to not original message producer and message will be just acked without response handling since id and callback pair is stored in different client. There are 2 ways to fix it:

  1. have separate subscription per client replica.
  2. nack message on client side if message handler is not found. Eventually message will be handled by original client

Second option IMO is better, since applications don't depend on infrastructure

from nestjs-google-pubsub-microservice.

alex-y-su avatar alex-y-su commented on June 19, 2024

I think there's no issue with the implementation of the transfer wrapper. Getting sticky sessions and pub/sub to work correctly can be quite challenging, regardless of the transport wrappers involved.

from nestjs-google-pubsub-microservice.

p-fedyukovich avatar p-fedyukovich commented on June 19, 2024

The second approach is implemented in #23

from nestjs-google-pubsub-microservice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.