CF Camp Notes: Event Gateways, Gert Franz

October 22, 2014

Event Gateways -- Gert Franz

What are Event Gateways
anything that java/railo can "react" to is an Event Gateway
additional way to contact the app server (aside from web services, etc)
doesn't have to be over HTTP, can be triggered by FTP too, etc.
CLI -- we don't have a "request" form the command line.

Example gateways in CF
Instant Messages
Text Messages from Phones
Java Messaging Service
- can use RabbitMQ to send events to/from Railo

File System Changes
- uses poling, waits for a second, does a cfdirectory to see if the info changed from what it had before.
- very inefficient
etc

Example Gateways in Railo
Instant messages
IRC chat
Active MQ messenger
Directory watcher
mail watcher
- can trigger something just by sending an email to a certain address
- it uses cfpop. end result is sort of like a scheduled task but it's 'event based' in this case.
ANY custom CFML event gateway

Message Generator
-- someone who sends an SMS text (for example)
Event Gateway
-- the thing that "reacts" to the event (a Java file, cfc etc)
Event Gateway Services
-- i have 50 listeners, let's inform those listeners that this thing happened.

Listener CFC
CFC that reacts to outside events
onAdd, onDelete, onChange, etc.

Method specified in Configuration is called
CF Event Structure passed as an argument
-- relatively complex
-- all the info that the event gateway passes on to the CFC
-- complex because it's decoupled from the rest of your code

Gateways aren't popular because they're complicated. and you need to know Java and need to know what you're doing. So they become difficult very quickly.

Interaction with CFML itself is limited.
--querying the database isn't possible

Code reuse isn't very easy either.

Write them in CFML (Railo) when possible.
Eventgateways written in Java for CF can be done also (Railo uses the same interface as the Java stuff)

DirectoryWatcher
MailWatcher
-- event gateways in Railo

(Demo time)

bitnami.com/contest
and vote for Railo