Comments (3)
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:
- have separate subscription per client replica.
- 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.
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.
The second approach is implemented in #23
from nestjs-google-pubsub-microservice.
Related Issues (20)
- Please provide a full example HOT 1
- There is no matching event handler defined in the remote service. Event pattern: undefined error message HOT 10
- multiple subscribers + Listen to a topic - Difference between emit and send HOT 1
- add replyTo property in client dispatch handler HOT 1
- add support to send attributes along with data object. HOT 1
- Support @google-cloud/pubsub version 3 HOT 3
- Only usable with Pub/Sub Admin permissions HOT 2
- Error: 4 DEADLINE_EXCEEDED: Deadline exceeded Pub Sub & NestJs HOT 2
- Readme regarding client.close is not quite clear HOT 3
- No DTO validation possible? HOT 1
- Create a Subscription with options
- Support for nest v10 HOT 5
- How to subscribe to multiple pub-sub topics? HOT 3
- Why is server.send called when only listening? HOT 16
- Bug: PubSub client is not connected: topic undefined does not exist HOT 4
- Extend support for Cloud Events
- Add support for ClientsModule.register HOT 3
- Decouple subscription creation from topic creation during "init"?
- Message falls when it is too large HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestjs-google-pubsub-microservice.