简体   繁体   English

当 S3 上有新文件时在 Kafka 上获取事件/消息

[英]Get event/message on Kafka when new file on S3

Im quite new to AWS and also new to Kafka (using Confluent platform and .NET).我对 AWS 很陌生,对 Kafka 也很陌生(使用 Confluent 平台和 .NET)。

We will receive large files (~1-40+Mb) to our S3-bucket and the consuming side of this should process these files.我们将接收大文件 (~1-40+Mb) 到我们的 S3 存储桶,并且它的消费端应该处理这些文件。 We will have all our messaging over Kafka.我们将通过 Kafka 进行所有消息传递。

Ive read that you should not send large files over Kafka, but maybe Im misinformed here? 我读到你不应该通过 Kafka 发送大文件,但也许我在这里被误导了?

If we instead want to just get an event that a new file has arrived on our S3-bucket (and of course some kind of reference to it), how would we go about?如果我们只想获得一个新文件已到达我们的 S3 存储桶的事件(当然还有对它的某种引用),我们将如何处理 go?

You can receive notifications about events that happen in your S3 bucket like when a new object is created/deleted etc.您可以收到有关 S3 存储桶中发生的事件的通知,例如创建/删除新的 object 时等。

From the S3 documentation (as of writing this), the following destinations are supported:从 S3 文档(截至撰写本文时),支持以下目的地:

  1. Simple Notification Service (SNS)简单通知服务 (SNS)
  2. Simple Queue Service (SQS)简单队列服务 (SQS)
  3. AWS Lamdba function AWS 拉姆巴 function

For instance, you can choose SQS as your S3 notification destination and use Kafka SQS Source Connector to stream the events to Kafka.例如,您可以选择 SQS 作为 S3 通知目的地,并使用 Kafka SQS Source Connector 将事件发送到 Kafka stream。 Then you can write your Kafka consumer applications that react to this events.然后您可以编写对此事件做出反应的 Kafka 消费者应用程序。

And yes, it is not recommended to send large files over Kafka.是的,不建议通过 Kafka 发送大文件。 Just send pointers to them and let the consumer application fetch the information using those pointers.只需向它们发送指针,让消费者应用程序使用这些指针获取信息。 If you are consumer wants to fetch some s3 objects, configure your consumer to use the S3 SDKs.如果您是消费者想要获取一些 s3 对象,请将您的消费者配置为使用 S3 SDK。

Useful resources:有用的资源:

  1. Enabling event notifications in S3 在 S3 中启用事件通知
  2. S3 Notification Event Structure (JSON) with examples S3 通知事件结构 (JSON) 及示例
  3. Kafka SQS Source Connector Kafka SQS 源连接器

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM