简体   繁体   English

Spring 云 stream 和使用 PubSubReactiveFactory 的背压

[英]Spring cloud stream and backpressure using PubSubReactiveFactory

I am trying to implement a flow control similar to https://cloud.google.com/pubsub/docs/pull#flow_control using spring cloud stream reactive client.我正在尝试使用 spring 云 ZF7B44CFAFD5C52223D5498196C8A2E7B 实现类似于https://cloud.google.com/pubsub/docs/pull#flow_control的流控制。

@Bean
ApplicationRunner reactiveSubscriber(PubSubReactiveFactory reactiveFactory, PubSubMessageConverter converter) {
  return (args) -> {
    reactiveFactory.poll("orders-subscription", 250L)
      // Convert a JSON payload into an object
      .map(msg -> converter.fromPubSubMessage(msg.getPubsubMessage(), Order.class))
      .doOnNext(order -> proccessOrder(order))
      // Mannually acknowledge the message
      .doOnNext(AcknowledgeablePubsubMessage::ack);
      .subscribe();
  };
}

It seems that back-pressure is not possible to limit number of data flowing through the system.似乎背压无法限制流经系统的数据数量。 Since the processing can last for few second I am afraid to cause some memory problems with high number of incoming message (millions of incoming message per day).由于处理可以持续几秒钟,我担心会导致一些 memory 问题与大量传入消息(每天数百万条传入消息)有关。

What I would like to achieve is a constant processing of 100 messages in the flux.我想要实现的是不断处理不断变化的 100 条消息。 Anyone had success implement it?有人成功实施了吗? Maybe reactive rabbitmq?也许反应 rabbitmq?

resolved using spring amqp and prefetch count.使用 spring amqp 和预取计数解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 spring 启动 2.6.1 中使用 spring-cloud-gcp-pub-sub-stream-binder 时未发现内部方法错误 - internal method not found error while using spring-cloud-gcp-pub-sub-stream-binder in spring boot 2.6.1 无法使用spring cloud kinesis stream启动spring boot - Unable to start spring boot with spring cloud kinesis stream 使用 pubSubReactiveFactory 重新启动无限 Flux - Restarting inifinite Flux on error with pubSubReactiveFactory 使用映射字段从 Cloud Firestore 过滤流 - Filtering stream from Cloud Firestore using map field 为 spring-cloud-stream 消息消费者设置权限/身份验证,使其通过 @PreAuthorize 检查 - Set permissions/authentication for spring-cloud-stream message consumer so it passes @PreAuthorize checks 仅将特定异常移动到 Spring Cloud Stream 中的 DLQ - Move only specific exception to DLQ in Spring Cloud Stream Spring Redis 使用 Redis Cloud 的连接超时 - Connection Timeout for Spring Redis using Redis Cloud 在具有数据流调度功能的谷歌计算引擎上部署 Spring 云数据流,无需使用 K8s 或 Cloud Foundry - Deploy Spring cloud data flow on Google compute engine with data flow scheduling feature, and without using K8s or Cloud Foundry 强调 spring 引导服务时消耗的 GCP Postgres 连接数(使用 SQL 云代理) - GCP Postgres connections consumed when stressing spring boot service (using SQL Cloud proxy) 使用 Firebase Stream 作为 Flutter 中另一个 Stream 的输入? - Using a Firebase Stream as an input for another Stream in Flutter?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM