A Comfortable Couch

Sunday, October 17, 2004

Agent Boost

This is for Notes geeks. If you're not a Notes geek, stop reading. You'll be confused or bored to tears.

One thing that is coming up a lot in my work with Lotus Notes is the need for extension manager hooks. These "hooks" are custom code that gets called whenever a particular action or event occurs on Notes and possibly allows the custom code to change the outcome of the event. They are useful in so many ways for development, but they are a total pain to write and update. One thing that's great is they let you put powerful processing on the server side, whereas with most of the other Notes programmability options the custom logic must run client side.

Writing the hooks are a pain. It requires a solid knowledge of C and C build tools, and you must the use the Notes C API, which is far more involved and verbose than anything most Notes developers are accustomed to. Worse than that, with the C API, one coding slip up and you've crashed the server. It shouldn't be this hard. It should be possible to do those things right in the designer client in the languages Notes already supports, and it shouldn't have dire consequences if you mess up. There is really no good technical reason Notes doesn't already have this.

So I'm making it a little easier with a project I call Agent Boost.

Agent Boost is an extension manager hook will allow you write regular Notes agents and have those agents be invoked during database and server events, like when a document is saved or mail is delivered. The agents will be able to do anything a regular agent can do, and it can change the event document or even abort the operation altogether. It can be installed on a Notes client or a Domino server, but it will really be most useful on the server side.

I've already gotten it working in a preliminary way, but its need a lot more before it's production ready. I've already spent 2 1/2 days on it, I think maybe 3 more and it'll be ready for beta testing.

I will be giving this away probably under a BSD license. Anyone will free to download it, inspect it, modify it, sell it or do whatever they want with it. This will be an experiment in Open Source development and its benefits and detriments, I'm hoping it will help promote me for consulting work.

But I'm also writing it because it's a small fun project. Since I figure it will probably take me about 2 years to build Couch to be production ready, I'll need a lot of small fun projects to keep me sane.

Anyway, the way I have it designed, from the user perspective (developer in this case) as follows:

There is a configuration database and in it are Agent Boost records. Each record contains a database name, an event and an agent name, plus other various options.

The events supported are note open, note update, note delete and mail arrival. All events have pre and post event options. For note open, update, and delete, they can either be global or apply to a single database. Mail arrival is a global event and occurs whenever mail passes through the server. Once an Agent Boost record is setup, your agent will be invoked whenever the event occurs. The agent accesses the document in the event via the already available NoteSession.DocumentContext variable,

One thing I'm thinking of changing is the use of the configuration database, instead I can map events to agents by using an agent naming convention. So an agent named something like "(NoteOpenAfter-LoadSalesRecords)" will run just after a document is loaded of disk but before it's displayed to the user. But since this tool already bypasses the Notes security model then any user can create an agent with a particular naming convention and have it invoked and do bad things. I don't know if there is an easy fix for that, easier than the configuration database model anyway.

I hope to have something downloadable soon. In the meantime I welcome any input from any Notes guys out there.


Anonymous said...


This would be way cool, I am trying to write an audit log, and it needs to intercept document reads/writes/edits on the server, so this add in would be fantastic.

Open Sourcing it is cool ,as this could easily form the basis of a commercial product !

7:37 AMlink  
Damien said...

Cool, sounds like a perfect use of this tool.

3:09 PMlink  
Anonymous said...

Where would you Open Source it? OpenNTF, SourceForge?

5:27 PMlink  
Damien said...

I'm not sure but I think I'll put it on OpenNTF.

8:05 PMlink  
Ben Poole said...

This sounds intriguing - great to see you still coming up with the goods for us Notes geeks ;o)

4:39 AMlink  
Anonymous said...

Ironic that I have to register to post on your blog with my name, isn't it Damien? :)

Anyway, this sounds really cool and I'm looking forward to playing with it. Since it hooks directly to noteUpdate, would that make it enabled for *any* update? I'm thinking specifically for replication here -- being able to trigger an agent as docs were replicated would be extremely powerful.

Also, the mail arrival, being a hook presumably at deposit into the mail.box, could be really interesting as well.

Are you thinking that there would be a significant performance hit, given load times for LS agents?

-- Nathan T. Freeman

10:12 AMlink  

Post a Comment

<< Home