SCDF处理器读取一条消息并输出对象数组,但汇聚器只能处理单个项目。

huangapple go评论52阅读模式
英文:

SCDF processor reads one message and outputs arrays of objects, but sink can handle single item

问题

我的处理器处理一个负载并生成一个列表

@StreamListener(Processor.INPUT)
@SendTo(Processor.OUTPUT)
public List<XYZObject> getAll(
    XYZInput inp) {
    List<XYZObject> xyzs = dbService.findAllByDataType(inp.getDataType());
    return xyzs;
}

这个流具有RabbitMQ中间件,我的接收器如下所示:

@StreamListener(Sink.INPUT)
public void writeToX(XYZInput input) {
    ....
}

我查看了一个类似的讨论[使用Kafka Binder的类似问题](https://stackoverflow.com/questions/62087870/spring-dataflow-processor-to-process-one-payload-and-write-multiple-rows-in-data)。如何在Rabbit binder中实现这个目标?

使用RabbitMQ作为绑定器是否可行?
英文:

My Processor process one payload and produce a List

  @StreamListener(Processor.INPUT)
  @SendTo(Processor.OUTPUT)
  public List&lt;XYZObject&gt; getAll(
      XYZInput inp) {
      List&lt;XYZObject&gt; xyzs = dbService.findAllByDataType(inp.getDataType());
      return xyzs;
  }

The stream has RabbitMQ middleware, and my sink looks like below:

@StreamListener(Sink.INPUT)
  public void writeToX(XYZInput input) {
    ....
  }

I took a look into a similar discussion Similar Problem with Kafka Binder. How to achieve this with Rabbit binder?

Is it achieveable with RabbitMQ as binder?

答案1

得分: 1

这是一个关于Spring Cloud Stream的问题,由spring.cloud.stream.bindings.<binding-name>.consumer.batch-mode属性控制。

请查看参考指南中的批量消费者/生产者部分以获取更多信息。

英文:

This is a Spring Cloud Stream question and is controlled by the spring.cloud.stream.bindings.&lt;binding-name&gt;.consumer.batch-mode property.

Please see the reference guide section for Batch consumers/producers to learn more.

huangapple
  • 本文由 发表于 2023年1月9日 19:50:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75056857.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定