简体   繁体   English

Spring Cloud Stream Kinesis 消费者组可以由非 Spring 生产者发送吗?

[英]Can a Spring Cloud Stream Kinesis consumer group be sent by a non-Spring producer?

In our environment, we have a producer that is not a Spring microservice sending Avro messages over Kinesis to a Spring Cloud microservice.在我们的环境中,我们有一个生产者,它不是 Spring 微服务,它通过 Kinesis 向 Spring Cloud 微服务发送 Avro 消息。 My question is how can the non-Spring producer add the consumer group message header to each message so that the Spring microservice can scale up to more than one instance, ensuring that the Spring microservices do not consume each message more than once?我的问题是非Spring生产者如何给每条消息添加消费者组消息头,让Spring微服务可以扩展到多个实例,保证Spring微服务不会多次消费每条消息?

Can this be done in Kinesis, and if so, are there any code examples anyone can point me to?这可以在 Kinesis 中完成吗,如果可以,是否有任何人可以指点我的代码示例?

I would say "Not clear what you're asking", but I'll try to explain what might be wrong.我会说“不清楚你在问什么”,但我会尽力解释可能有什么问题。

The Consumer Group is an abstraction, well..., for consumers.消费者组是一个抽象,嗯……,对于消费者。 The producer has nothing to know about that abstraction.生产者对这种抽象一无所知。 It's point just send messages to the destination and forget.只需将消息发送到目的地并忘记即可。

One of main goals of the consumer group abstraction is to ensure that message is processed only in one consumer meanwhile there might be more than one consumer in a group.消费者组抽象的主要目标之一是确保消息仅在一个消费者中处理,同时一组中可能有多个消费者。

There is a feature in AWS Kinesis complementing consumer group abstraction. AWS Kinesis 中有一项功能可以补充消费者组抽象。 It is sharding in Kinesis streams.它在 Kinesis 流中进行分片 With consumer group implementation in Spring Cloud Stream, there is a trick to distribute shards between consumers in a group, so they can be processed in parallel.通过 Spring Cloud Stream 中的消费者组实现,有一个技巧可以在组中的消费者之间分配分片,因此它们可以并行处理。

Here you really can benefit fro sharding saying to your producer to which one to send a record.在这里,您真的可以从分片中受益,告诉您的制作人要将记录发送给哪个人。 See more info about partitionKey in Kinesis Producer API.在 Kinesis Producer API 中查看有关partitionKey更多信息。

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

相关问题 Spring 云 stream Kinesis 生产者无法连接到本地堆栈 - Spring cloud stream Kinesis producer can't connect to localstack Spring 云 Stream 功能性生产者/消费者 - Spring Cloud Stream functional Producer/Consumer 抽象 Spring 云 Stream 生产者和消费者代码 - Abstracting Spring Cloud Stream Producer and Consumer code 非 Spring Cloud Stream (SCS) 生产者向 SCS 消费者发送 JSON 消息 - Non Spring Cloud Stream (SCS) producer sending JSON message to SCS consumer 春季云流-消费群约束 - spring cloud stream - consumer group bound 使用Spring Cloud Stream将RabbitMQ使用者绑定到RabbitMQ生产者 - Bind RabbitMQ consumer using Spring Cloud Stream to RabbitMQ producer 生产者和消费者如何绑定Spring云stream绑定? - How to bind Spring cloud stream binding for producer and consumer? 多云应用程序中的Spring Cloud Stream DLQ,生产者和消费者 - Spring Cloud Stream DLQ, Producer and Consumer Residing under Multiple Application Spring 云 Stream 与 RabbitMQ 绑定器和事务性消费者/生产者与 DB 操作 - Spring Cloud Stream with RabbitMQ binder and Transactional consumer/producer with DB operations 春季云流运动学配置 - spring cloud stream kinesis configuration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM