Slee
Slee

Reputation: 28258

message queue for iOS / iPad - something like MSMQ?

I have an iPad app that works both on and offline but when I am offline there are web service calls that will need to be made once online availability is an option again.

Example: A new client is added to the app, this needs to be sent to the web service but since we are offline we dont want to slow the user down so we let them add locally and keep going but we need to remember that that call needs to be made to the web service when we can. Same thing for placing orders and such.

Is there some sort of queue that can be setup that will fire once we have connectivity?

Upvotes: 6

Views: 4757

Answers (2)

Joel
Joel

Reputation: 16134

This library handles offline persistent message queueing for situations like you describe. It says alpha from a year ago, but I have confirmed it is used in production apps:

https://github.com/gcamp/IPOfflineQueue

Upvotes: 1

Peter DeWeese
Peter DeWeese

Reputation: 18333

I don't think the overhead of a heavyweight tool like MSMQ is needed for a simple action. You can use Core Data, persist managed objects with the data needed to call the web service, and only delete each managed object after a successful post. There might or might not be a way to capture an event when connectivity starts, but you can certainly create a repeating NSTimer when the first message is queued and stop it when there are no messages in the queue.

Upvotes: 3

Related Questions