Azure Mobile Apps - Offline Data sync - App is not running - azure

Below is one of the features of Azure Mobile Apps - Office Data Sync
When your app is in offline mode, users can still create and modify data, which will be saved to a local store. When the app is back online, it can synchronize local changes with your Azure Mobile App backend.
As per the above, does that mean the synchronization of the local changes happens only when the app is online (user needs to explicitly open the app)? Or the data gets synchronized to server automatically when the mobile connects to internet via some background service?

For an overview of offline data sync, see Offline Data Sync in Azure Mobile Apps, particularly How offline synchronization works.
The SDK does not do anything automatically with regard to the sync operation itself. You have to either add code that syncs on a timer, or detects network connectivity changes. If you want to sync as a background task, you will have to register the sync code with the OS and call PullAsync and PushAsync in that code.
Basically, the SDK tracks changes for you and sends them when you call PushAsync, but your code manages when this happens.

As the document says:
Changes are stored in a local database; once the device is back online, these changes are synced with the remote backend.
Which means user should open the app first before syncing data.

Related

Synchronising in memory data between Azure Front Door back end instances

I have a web application in Azure. There are 2 instances, with Azure Front Door being used to route all traffic to the primary instance only, with the secondary one only ever used if the first is unavailable. We have some in memory data that gets updated by users. The database is subsequently updated with the changes. The data is kept in memory as a function of a genuine performance requirement. The issue we have is the data is fetched from the database only on application start up, meaning that if the primary instance becomes unavailable the secondary one could very well have information that is out of date. I was hoping that Front Door could be configured to trigger an API when any sort of switch - from primary to secondary or vice versa - occurs. However I can't find any reference to this in the documentation.
We have a series on web jobs that run, one of which is triggered every minute. However using this to keep the data fresh still doesn't guarantee that an instance will necessarily have the latest information.
Any thoughts on how to rectify this issue very much appreciated.
[EDIT]. Both web apps talk to the same database instance
Unfortunately Azure Front Door doesn't have any native support for firing events to something like an Event Hub but you could stream your logs to one. For example you could stream "FrontDoorAccessLog" to an Event Hub and have a script receive these events. When the "OriginName" value changes you could inform the failover app to update its state via an API.
Is there a reason why both Webapps have their own database if they have to be somewhat synchronized? Why not have both Webapps talking to the same DB?

Push notification from azure blobstore to arbitrary number of webapps

I use data stored in in a blob for some configuration for some azure web apps, and I'd like to react to changes to it in near realtime. Currently I just set a timed event and periodically check if the etag of the blob has changed, and if it has then download the new blob.
This is ok, but I don't want to poll the blob too often, and I also want to be reactive. The devs changing the values in the blob want to be able to test the new values quickly.
The web app scales up and down, and each instance of the web app needs to download the config file. So, as far as I can tell, I can't just use the event system that azure storage has, as that would only send a notification to one instance.
Is there a recommended way to do this?
Per my understanding, you want to centralize manage your azure web apps. Once some config has been changed, your app services should reload configs on time automatically. Actually, Azure App Configuration provides this kind of functionality.
You can also config the condition to reload all configs in code. This is a .net core sample here. And you find other samples under the Enable dynamic configuration blade.

Azure push notification to update app state

I am new to Azure so forgive me if my question sounds unclear but I will try to explain the best I can.
I think it is common nowadays to need some kind of push notifications rather than pulling data in a timed interval.
So, if I have a mobile app, a web app, and a desktop app all talking to Azure, if one of these apps updates something in Azure SQL database, I would like to avoid to have to pull for this change in my other apps but instead get pushed these changes automatically to them.
I think there should be some kind of mechanism in Azure notifying the applications (whether web, mobile, desktop) about these changes.
Is there something like that? What should I look into?
UPDATE 1
Assume I have an web (Angular or whatever) Azure app talking to Azure SQL database storing cars information. This app allows me to do CRUD operations so I can add, update, delete, read cars from database.
Database currently has info about BMW and Toyota only
User logs into my web app and sees info about BMW and Toyota which is info
existing in my Azure SQL database.
User logs into my mobile app which connects to azure and pulls info from database and shows BMW and Toyota on screen
User logged in web app adds new info about Honda (or deletes an existing car, or updates an existing car), info is stored in
database and Honda shows in web app
User logged into mobile app would now have to tap on refresh button to pull the latest data from database.
How can this data be automatically and immediately pushed to mobile app instead of having mobile app pull it in some interval or on tap on a Refresh button?
Absolutely! Azure has several messaging solutions to solve this type of problem. But without fully understanding your problem space, the semantics of your data or your overall architecture, it's hard to give precise and tailored guidance. Given that you've mentioned that some of your clients will be mobile devices, you should opt for something lightweight such as Azure Notification Hubs. You should also review the Service Bus and Event Hubs here.
With whatever service you choose, I wouldn't recommend sending the actual data itself in these push notifications. Keep notifications extremely lightweight. A client, upon receiving the notification, can react by polling your backend for the actual data change.

Data processing in the cloud with Windows Azure

I have build a Windows Phone app. I send data to a database in Azure. I need this data to be processed and the results to be send back to the user, so the app remains 'light'.
Sorry if the question is a bit general, but what service should I use to process data in the cloud?

Access WebRole data from .aspx page

I am working on TCP/IP in Windows Azure and am successfully able to develop a TCP client to send and web-role to receive the TCP data.
I want to display this received data in a .aspx page. How should I access the webrole data from .aspx page?
Regards,
Anil
Having read the long comment stream, I think I get the essence of this scenario and question. It appears that there's some tcp-listener code being launched from within webrole.cs, not within the asp.net app code.
Here's the thing: A Web Role is Windows Server 2008 with IIS, along with some Windows Azure code for handling bootstrap and shutdown tasks. The webrole.cs file you speak of is the bootstrap/shutdown code entry point, with methods such as OnStart(), Run(), OnStop(), and Stopping(). This code is run in a separate AppDomain than your web app.
If you're launching a ServiceHost (or some other port listener) from webrole.cs, that's fine, but you'd need to then store content somewhere temporarily after it's uploaded, then make it available for your web app later. You could choose durable storage such as SQL Azure or Azure Storage (blobs or tables), or volatile storage (e.g. a local disk). You could then use some type of communication scheme to notify your web app that it has new data display, possibly by placing a message on an Azure queue, or having your web app just query a table for data each time a user requests it.

Resources