简体   繁体   English

具有初始 state 的流

[英]Streams with initial state

I would like to expose something like a subscription or a "sticky query": the goal is to query DynamoDB and return the results via the WebSockets API in API Gateway.我想公开订阅或“粘性查询”之类的内容:目标是查询 DynamoDB 并通过 API 网关中的 WebSockets API 返回结果。 Well, whenever DynamoDB changes in a way the query would be affected (I guess I could use Streams for that) I would like to notify the client(s).好吧,每当 DynamoDB 以某种方式发生更改时,查询都会受到影响(我想我可以为此使用 Streams),我想通知客户端。 How can I make sure the client gets the initial list and all updates?如何确保客户端获得初始列表和所有更新? I would like to make sure the client doesn't miss any updates right after the subscription is created and before the initial list of results is returned to it...我想确保客户端在创建订阅后和返回初始结果列表之前不会错过任何更新......

To inform your clients about changes in your DynamoDB, DynamoDB Streams could be used.要通知您的客户有关您的 DynamoDB 的更改,可以使用DynamoDB Streams However, the information is only available for 24 hours.但是,该信息仅在 24 小时内可用。 Even if you write your updates to a Kinesis Stream , your information will be available for a maximum of 7 days (according to the FAQ )即使您将更新写入Kinesis Stream ,您的信息也最多可使用 7 天(根据常见问题解答

I suggest splitting your use-case in two:我建议将您的用例分成两部分:

  • Create a service where you return the initial state of your "sticky query"创建一个服务,您可以在其中返回“粘性查询”的初始 state
  • Create a stream which will notify your clients about updates to the "sticky query"创建一个 stream 它将通知您的客户有关“粘性查询”的更新

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

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