Working with an Auto-Reply mail agent
Category Administration
I thought I'd give a summary of some work I did this week with an Auto-Reply mail agent. The agent was written six years ago to provide quick customer response, it's scheduled to run every hour. It wasn't really developed with any in-depth analysis—just the sort of one-off job that Notes does so very well.
However, the agent was never designed to be run against 30K documents, or be duplicated with over 400 installations. Ouch. So, finally I was able to get some time to pull it apart and build a replacement. The code wasn't too lengthy, but it was written in classic spaghetti code with lots of GOTOs. Ycch.
The basic logic for the original code was to create a sorted collection of documents which have not been marked as processed. This means that if the database had 100 documents, the collection was quick to create, but with tens of thousands of documents in many of the applications, semaphore locking was creeping up and the agent began to fail.
It didn't make sense to try and hone done the sorting, there are just too many of these agents running. So, I split the function into two parts: (a) a BeforeNewMail agent to guide inbound mail into a hidden folder and (b) a scheduled agent to run through the folder and process the new mail.
The agent also had one goofy mistake—it was supposed to allow the reply address to be be customized, but the code didn't work as intended. Lotus Notes doesn't make it easy to spoof an address.
If you look for information with Notes mail and “iNetFrom” and “Principal” you'll find that a common solution is to create the faux-return e-mail directly in the mail.box. I don't really like the idea of an agent creating a document directly in the mail.box. It's not recommended by IBM, and I don't trust any code to never-ever experience a run-time incident, which would be bad in this instance. I recommend creating the mail as a document, and then copying it directly into a mail.box.
So, the new agent code is humming now (with OpenLog, of course), and maybe, just maybe, I can make enough time to peer into the Auto-Forward agent next week. It runs in thousands of databases.
I thought I'd give a summary of some work I did this week with an Auto-Reply mail agent. The agent was written six years ago to provide quick customer response, it's scheduled to run every hour. It wasn't really developed with any in-depth analysis—just the sort of one-off job that Notes does so very well.
However, the agent was never designed to be run against 30K documents, or be duplicated with over 400 installations. Ouch. So, finally I was able to get some time to pull it apart and build a replacement. The code wasn't too lengthy, but it was written in classic spaghetti code with lots of GOTOs. Ycch.
The basic logic for the original code was to create a sorted collection of documents which have not been marked as processed. This means that if the database had 100 documents, the collection was quick to create, but with tens of thousands of documents in many of the applications, semaphore locking was creeping up and the agent began to fail.
It didn't make sense to try and hone done the sorting, there are just too many of these agents running. So, I split the function into two parts: (a) a BeforeNewMail agent to guide inbound mail into a hidden folder and (b) a scheduled agent to run through the folder and process the new mail.
The agent also had one goofy mistake—it was supposed to allow the reply address to be be customized, but the code didn't work as intended. Lotus Notes doesn't make it easy to spoof an address.
If you look for information with Notes mail and “iNetFrom” and “Principal” you'll find that a common solution is to create the faux-return e-mail directly in the mail.box. I don't really like the idea of an agent creating a document directly in the mail.box. It's not recommended by IBM, and I don't trust any code to never-ever experience a run-time incident, which would be bad in this instance. I recommend creating the mail as a document, and then copying it directly into a mail.box.
So, the new agent code is humming now (with OpenLog, of course), and maybe, just maybe, I can make enough time to peer into the Auto-Forward agent next week. It runs in thousands of databases.
- 


Comments
Posted by Brian Green At 01:39:01 AM On 07/20/2007 | - Website - |
Nathan -- yep, the agent just wasn't written with any real understanding of scaling. There is a lot of legacy code that continues to perform terribly, because the risk of touching it and failing is a more serious consequence.
Bruce -- you're right, there is never, ever is enough time to do the invisible things. Right now, my desk top is covered in paper piles of hope-to to-dos.
Kevin -- thanks for the link !! Very cool !! And when we actually get all the servers onto ND7, then I can look at the templates more closely. We still have R5 servers and ND6. Upgrades are coming.
Posted by Jack Dausman At 09:48:31 PM On 07/13/2007 | - Website - |
Posted by Nathan T. Freeman At 08:38:49 PM On 07/13/2007 | - Website - |
Posted by Bruce Currier At 07:59:21 PM On 07/13/2007 | - Website - |
{ Link }
It has to really great agents that handle auto-responses AND auto-forwarding. Very nicely written, and very configurable. May still need some tweeking to handle volume and do cross database, but no spaghetti at least
Posted by Kevin Pettitt At 02:23:05 PM On 07/13/2007 | - Website - |