Skip to main content

Design Question

4 replies [Last post]
nickfox
Offline
Joined: 2007-05-15
Points: 0

I'm building an app that gets gps location data and sends it to a web server. When I get the location data, I want to put it into a queue and then have another process pull the location data off the queue and send it to the website. I want the gps location process to be decoupled from the http sending process for those times that the cell phone is out of coverage area.

I'm thinking of 2 different ways of doing this:

1) have a worker thread that is notifed when locations are placed in the queue and then have the worker thread try to send locations to web server. if it fails, then leave location data in queue.

2) use a timer and timertask for the http sender and have it poll the queue to see if there is location data there.

which method do you think is best? is there a third way that might be better?

thanks
nick

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nickfox
Offline
Joined: 2007-05-15
Points: 0

i should probably say that I'm using the sprint IDEN network with the motorola i355 phone.

akhilarora
Offline
Joined: 2004-12-17
Points: 0

I have a BT GPS receiver that refreshes every second. I saw another one out there that refreshes at 5Hz - 5 readings per second. This could easily cause the queue to overflow, even 1Hz might be too quick to handle. So you may have to discard some readings, or average them out, depending upon the application.

Could also store the readings temporarily in RMS if you don't want to discard them, but RMS has its limits too.

nickfox
Offline
Joined: 2007-05-15
Points: 0

Thanks for your answer. I don't plan on getting data anymore than once per minute. My main concern is trying to get the most accurate data possible and not losing any of that data due to not being able to connect to the http server.

akhilarora
Offline
Joined: 2004-12-17
Points: 0

I guess then you may want to write the data to RMS first and then attempt transfer. It seems like you're looking for the functionality of something like WS-ReliableMessaging or reliable message queues. I don't know of any implementations of this stuff for JavaME at this time.