开发者

How to do mobile app sync with cloud service like amazon (sqs/sns) or azure

开发者 https://www.devze.com 2023-03-20 18:30 出处:网络
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.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消