如何与亚马逊 (sqs/sns) 或 azure 等云服务同步移动应用程序

发布于 2024-11-24 02:57:01 字数 516 浏览 3 评论 0原文

我想实现几个移动应用程序(Windows Phone/iOS/Android)的想法。其中大多数需要在其他设备组上获取用户数据更新。

例如, 1 不需要立即更新发送到群的场景: 假设家庭成员可以在应用程序中跟踪他们的支出。新添加的费用将自动同步到其他家庭成员设备(或在他们选择同步时手动同步)。

需要立即将更新发送到组的第二种情况: 让我们考虑一下所有的纸牌游戏 或者在二十一点的游戏场景中,我们需要通知牌桌上的所有玩家庄家为他们每个人开了哪张牌。

问:我开始寻找 Amazon SQS(队列)、SNS(通知)服务。但初步阅读并没有让我得出任何结论。我也要去读Azure。

哪些服务可以帮助我实现上述场景?

SQS 问题:SQS 将如何运作?如果我从队列中读取一项,我猜测它将从队列中删除。因此,如果一台设备添加了新费用,系列中的其他设备则不会,因为项目已从队列中删除。或者可能是 - 我是否只为每个设备创建一个队列? (也许我最后的额外代码逻辑可以帮助我)。

请向我提供有关这些服务的任何见解。

谢谢

I want to implement couple of mobile app (windows phone/iOS/android) ideas. Most of them require getting user data updates on other group of devices.

For example,
1 scenario which does not need immediate update sent to the group:
let's say a family member can track their expenses in the app. Newly added expense will automatically be synced to other family member devices automatically (or manually when they choose to sync).

2nd scenario which requires immediate update sent to the group:
Let's consider all the cards games
Or in a game scenario of blackjack, we need to notify all the players on the table about which card did the dealer open for each of them.

Question: I have started looking Amazon SQS(queue), SNS (notification) services. But initial reading did not get me to any conclusion yet. I am also going to read Azure.

What service(s) should help me achieve above scenarios?

SQS question: How will SQS work? If I read one item from the queue, I am guessing it will be removed from queue. So, if one device gets the new expense added, other devices in the family won't, because item was removed from the queue. Or may be - Do I just create one queue per device? (May be additional code logic at my end can help me).

Please provide me any insights into these services.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

り繁华旳梦境 2024-12-01 02:57:01

很难回答的问题,也有点具体。答案是那句著名的建筑名言:“视情况而定”。我可以帮助您解决 Azure 部分,并且我确信它也可以以某种方式翻译到 Amazon。

让我们看看您的场景。

  • 场景 1 不需要您所说的立即更新。因为也可能有 N 个客户端,所以在我看来,处理这个问题的最佳方法是表存储。您将费用存储在表存储中,并将某些金额等存储在单独的行中。要访问这些数据,有两种可能的方案,(1) 创建一个 WCF 服务来处理身份验证和验证。授权以及数据检索,通过公开诸如 GetFamilyExpenses(familyId); 之类的方法或(2) 在 Azure 上使用 AppFabric(a虽然有点贵)用于身份验证和直接访问表存储。更新在您的应用程序内部处理...
  • 场景 2 也有点具体。因为它是一款游戏,所以更新比其他任何东西都需要更加即时。我对这里正确实现的看法是直接与服务(托管在任一服务上)建立 TCP 通道并通过某些自定义协议进行通信。队列不会帮助你,因为(至少在 Azure 上)你仍然需要轮询它们。
  • 场景 3 您没有提及,但这是队列发挥作用的地方。假设您有 5 家零售店、一位带笔记本电脑的经理和一个仓库。当零售商店的库存达到指定数量时,需要从仓库发货新商品。因此,当进行购买时,队列项目会发送到两个主题:一个审核主题和一个仓库主题。审核主题由经理的应用程序读取,它允许经理查看发生的一切

这是我看到的 Azure 选项的基本概述。如果对您有帮助,请不要忘记点赞/标记为答案。

Tough question to answer, a bit specific too. The answer is that famous architectural quote, "it depends". I can help you out with the Azure part, and I'm sure it can be somehow translated to Amazon as well.

Let's take a look at your scenarios.

  • Scenario 1 doesn't need immediate updates you say. Because there can also be N-many clients, it seems to me the best way to handle this would be Table Storage. You store the expenses in a table storage, and store certain sums, etc., in a separate row as well. To access these data there are two possible scenarios, (1) create a WCF service to handle authentication & authorization, as well as data retrieval, by exposing a method such as GetFamilyExpenses(familyId); or (2) use AppFabric on Azure (a bit expensive though) for authentication and access table storage directly. The updates are handled inside your application...
  • Scenario 2 is a bit specific as well. Because it is a game, the updates need to be more instantanious than anything else. My view on the correct implementation here is to establish a TCP channel directly with the service (hosted on either services) and communicate via some custom protocol. Queues won't help you, because (at least on Azure) you still need to poll them.
  • Scenario 3 you haven't mention, but is where queues come into play. Imagine you have 5 retail stores, a manager with a laptop, and a warehouse. New items from the warehouse need to be dispatched when retail stores reach a specified number of stocked items. So when a purchase is made, a queue item is sent to two topics, an audit topic, and a warehouse topic. The audit topic is read by the manager's application and it allows the manager to see everything going on.

That's a basic overview of the options I see you have with Azure. Please don't forget to upvote/mark as answer, if it helps you out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文