Wednesday, June 10, 2009

Rochester Bound, Soon

As I see the days until my Rochester trip on Sunday erode, a few things come to mind.
1)  I do not want to go, but that's irrelevant.  It's boring, but I'm getting paid.  Classic business trip.
2)  Currently, the laptop I ordered from Dell specifically for this trip has yet to arrive.  Three business days remain.

3)  Neat projects this week.  =)

I've been working on a neat project this week to deal with our company's incoming orders.  It's neat for a lot of reasons, but here's one of my favorites real quick:

The same application can run in three different modes, configured in its settings page:  Local, Remote, and Relay

Remote mode is responsible for order file distribution to subfolders where file mirroring software picks it up and transfers it to our local location.  It is also responsible for cleanup of old order fragments (abandoned orders) and transferred files (completely mirrored).

Local mode is responsible for order file distribution to subfolders locally where the order processing servers pick them up.  During this process, the software records that the file is complete in a compact database.  Periodically, the local mode agent tries to tell the remote mode agent to delete a transfer once complete.  Once the remote agent confirms that an order file has been removed, it is stricken from the database only then.  This ensures that it always happens without fail, even through Internet outages.  Local mode also sends out a broadcast packet every so often, which will be explained below.

Relay mode is the only mode that has nothing to do with distribution or file management.  Its sole responsibility is to listen for the broadcast packet from the local mode client.  Once it receives the packet, the remote address is locked in and the relay tries to connect to the local client.  Any time a connection attempt fails or it is disconnected, it simply retries every 15 seconds or so.  It does the same thing with another socket to the remote mode agent.  It also messages the local mode agent any time it is disconnected from or reconnected to the remote mode agent.  With that information, the local mode agent is able to pick an active link to the remote agent for communicating file deletion commands, etc.  This gives the added benefit of retaining functionality across multiple WAN links even when one dies.

Pretty neat stuff, and this is only a small part of what it can do.  :)

No comments: