graphql-kafka-subscriptions | Apollo graphql subscriptions over Kafka protocol | GraphQL library
kandi X-RAY | graphql-kafka-subscriptions Summary
kandi X-RAY | graphql-kafka-subscriptions Summary
Apollo graphql subscriptions over Kafka protocol
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of graphql-kafka-subscriptions
graphql-kafka-subscriptions Key Features
graphql-kafka-subscriptions Examples and Code Snippets
Community Discussions
Trending Discussions on graphql-kafka-subscriptions
QUESTION
I have the following situation:
- I have 5 instances of the same service, all in the same kafka consumer group. One of them has a websocket connection to the client (the graphql subscription). I use graphql-java and Spring Boot.
- When that connection is opened, I produce events from any of the 5 instances (with a message key defined so they go to the same partition and ordered) and I need for all those events to be consumed by the same instance that opened that connection. Not by the other 4.
- Even if the partition assignment plays in my favor, a reassignment can by done at any time, leaving me without luck
My implementation is using reactor-kafka but I think it's just an implementation detail.
The options I see are:
- Start to listen on that topic with a new group id each time, so that service always receives the messages from that topic (but the 5 in the other group id too)
- Create a new topic for each websocket connection, so only the producer knows that topic (but the topic id should be sent in the kafka events so that the producers of those events know where to publish them)
- If I receive the message and I'm not the one with the connection, don't ACK it. But this would make things slow and seems hacky
- Start using something different altogether like Redis PubSub to receive all messages in all consumers and check for the connection.
I see there's an implementation for node but I don't see how it is solving the problem. A similar question explains how to program a subscription but doesn't talk about this distributed thing.
Is the cleanest approach any of the one I suggested? Is there an approach with Kafka that I'm not seeing? Or am I misunderstanding some piece?
...ANSWER
Answered 2019-Mar-29 at 17:33I ended up using 1 consumer group id per listener with a topic specifically for those events.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install graphql-kafka-subscriptions
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page