The system has been working pretty well for the pat few days, but a problem that I knew about a month or two ago seems to be rearing it’s head me the usual lately.

I knew I was having a problem with large messages, in excess of 1MB. The small ones are fine, but the big ones are a problem. I suspect it has to do with writing the file form memory and the connection timing out in the mean time. I get the file and process it just fine, but the client seems determined to send the message over and over again …

So I’ve decided to create a much more elaborate insert queue. Till now I’ve been relying on a record being passes through a finite state machine. I think it is time to start writing files earlier and using them to be able to recreate the state of a message if it fails.

I’ve looked at the way a few other system work and I think I’ve come up with a directory structure, naming convention and a few states that will simplify the process.

Hopefully the process of doing more writes, but with smaller amounts of data will get rid of the timing issue. Either case making the system able to recover from a crash or shutdown better will improve things quite a bit.