Code from CFUG Presentation

Posted At : January 31, 2008 10:56 AM | Posted By : Dave
Related Categories: Presentations

As promised, here is the code from my 1/31/08 presentation to the online CFUG. The code does contain CF8 functions so be careful if you are going to run the code in previous versions.

Download Code

Till next time,

--Dave

Comments
Hi Dave,

Just listened to your Directory Watcher talk from 1/31/08. Nice job. I wanted to clarify a few things about the Directory Watcher and the Event Gateway system in CF

1. Out count is always 0 - this is the number of messages/events that the gateway has sent, well, out. For instance how many times SendGatewayMessage() was called for this gateway. Since the DW doesn't do outgoing messages, this count will of course always be zero.

2. Return values from the gateway
I filed a bug on this for you (#71311). The problem is that as a convenience the gateway system will take the return value and send that "out" to the gateway. For instance if you receive an SMS or IM message to one of those gateways, you can return a Struct with a reply message and the system will (in effect) call SendGatewayMessage() on that gateway with that struct.
Since you are returning a simple value (i.e. "1") CF tries to make that a Struct, fails and reports the strange error. It *should* ignore that return value and log a warning (in the eventgateway.log) that it is doing this. Sorry for the confusion.

3. Timeouts
Event Gateway CFC function calls are subject to the same timeout value as ColdFusion requests. A gateway can override this value (in the Java code) by calling CFEvent.setCfcTimeOut(). Otherwise the timeout is the same as for "regular" CFML page requests.

4. Renaming a file
The Directory watcher does in fact report an ADD and a DELETE event when you change the name of a file. This is by design and I verified this on ColdFusion 7 and 8.

Hope this info helps, I will also post this to my blog with a pointer to your session.
# Posted By Tom Jordahl | 2/20/08 12:37 PM
Tom,

Thanks for the clarification and the filing of the bug.

--Dave
# Posted By Dave Ferguson | 2/20/08 1:11 PM