Scribble on a Pull-turns-push architecture based on http – registering web applications as event listeners
Today in the car I had some thoughts on applications working together, across the boundaries of technology and organizations. I tried to find an easy, cheap way for for example web applications to keep tracks of events of interest happening around it. No need for expensive, fancy or complex SOA, JMS, ESB etc. infrastructure.
I came up with this fairly simple architecture where a web application publishes a Servlet that can be called with event-notifications. These are simple, almost fire-and-forget messages that are replied to with minimal responses. The notifications are plain old Http(s) get and/or post requests that contain simple properties like type of event, category, timestamp and data attributes. A notification can signify a new entry in an rss feed, the reception of an email or IM message, the change in a piece of data, a development in a business process (BPEL sensor output) or sporting event, change in an application parameter or anything the application may find of interest.
The servlet passes the data on to a singleton object (and/or an object in the application scope of the web application). Sessions may have registered listeners on this singleton event dispatcher, that will be notified of the events received through the servlet by the dispatcher that satisfy their criteria.
The servlet can be called by any event publisher anywhere in the world, either in plain Http or in secure Https.
One interesting option would be to enlist the help of a CIA – a Central Intelligence Agent – that listens/polls for events on behalf of interested parties. The CIA could repeatedly listen to for example RSS feeds (pull model) and upon discovery of a new entry turn it into a push event by calling web applications that registered their interest with the CIA. Any event that the CIA can discover by itself – or is notified of by event publishers – can be sent to Http-based listeners.
Note that the Oracle Database can be such an Http listener – through its PL/SQLGateway using for example DBMS_EPG (http://technology.amis.nl/blog/?p=1628) – that is notified of external events. The database can also publish events – using the supplied package utl_http. This means that this architecture could be used as a way of exchanging event information between databases, across http(s) and through most firewalls.
- Using ADF BC Event Listeners to monitor data changes application wide through RSS Feeds and Monitor Pages
- Registering non-default XMLDB HTTP/WebDAV and FTP ports on a non-default Oracle Listener port
- Enhance the web page look & feel and behavior after it has been loaded – attach onLoad Event Listeners during load
- Spring and Oracle ADF – registering a POJO Spring JDBC based Business Service as Data Control
- Invoking HTTP Services from Oracle BPEL PM – SOA enabling PHP, Servlets, RSS,…