This question is related to this other question I recently asked…
cf.net exception and other logging
I am generating log messages to be sent to a server using a webservice over a GPRS connection and I want to simply queue these messages in the case the connection to the server is not available. Later I may also want to batch them to save bandwidth. What is best (easiest) way of doing this using cf.net. I need the queue to be somehow persisted across app restarts and preferably across device restarts.
Does anyone have any advice? Or better still a code example 🙂
Many Thanks.
Typically what I’ve done is push the data into a database table (SQLCE is my typical route). When I need to push something to the web service, I send it to the dispatcher, which in turns puts it into the database. The dispatcher has a background thread that pulls data out of the database, sends it, then does a database delete upon successful send. It also monitors connection state.
A queue in the dispatcher is a little cleaner and faster, but your desire to persist across app and device restarts requires persistent storage, so a database is probably the simplest mechanism.