织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

How to properly configure Netflix DGS SubscriptDG游

时间:2025-08-06 14:59来源: 作者:admin 点击: 7 次
I'm trying to understand how to properly setup the Publisher for Netflix DGS Subscriptions. I have found two interesting examples: If the subscriptio

I'm trying to understand how to properly setup the Publisher for Netflix DGS Subscriptions.

I have found two interesting examples:

If the subscription model is "one subscriber per GraphQL subscription connection, i.e. websockets", conceptually, if feels like we need to use a ConnectableFlux from the Netflix to . But on the other hand, Spring-GraphQL is using Sinks.Many to . And I'm struggling finding documentation on the tradeoffs between the two.

Both seem to manage backpressue, albeit with slightly more configurable options in Sinks.Many. And ConnectableFlux seems to manage subscribers more elegantly with refCount....maybe Sinks.Many does as well too.

I can easily bridge the gap between both approaches like so:

@Component public class SinkConfig { private final Sinks.Many<Review> sink; private final Flux<Review> reviewFlux; public SinkConfig() { Sinks.Many<Review> sinks = Sinks.many().multicast().onBackpressureBuffer(Queues.SMALL_BUFFER_SIZE, false); this.reviewFlux = sinks.asFlux().publish().refCount(1); this.sink = sinks; } //Only subscribe to reviews written by a particular user Publisher<Review> publisher(String input) { return reviewFlux.filterWhen(x -> Mono.fromCallable(() -> x.getUsername().equals(input))); } void emit(Review review) { sink.emitNext(review, Sinks.EmitFailureHandler.FAIL_FAST); } }

The above example seems overly complicated when compared against the Spring and Netflix examples. And I'm looking for a configuration that would be best suited to manage 1000's of concurrent subscriptions that are filtering on usernames.

Any help would be greatly appreciated!

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-08-13 05:08 最后登录:2025-08-13 05:08
栏目列表
推荐内容