HTTP Ping-test with assemblies.
Justin Mason blogged about an interesting use of Jaiku for http-ping testing. It has an open-API, SMS testing etc. We are currently just rolling out our new assembly framework, so I thought can I do the ping-test easily in assemblies. As it is I can. So here is all the working code for the assembly.
It sets up a static-file event (running every 10 seconds according to a cron schedule). This event creates a static message which is routed to a HTTP-out transport (see routes-to attribute of static-file-in). The http-out transport is used to ping some URL (in this case dink.capeclear.com). If this ping fails, then an error handler (sendError) is automatically invoked. This sendError command routes a message to GoogleTalk IM (xmpp-out).
The result is that if dink.capeclear.com is not available, someone gets an IM message on googleTalk.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:cc="http://www.capeclear.com/assembly/10">
<cc:assembly id="CapeClearAssembly">
<cc:staticfile-in input-file="myfile.txt" id="staticFile"
routes-to="httpCheck">
<cc:schedule cron="0/10 * * ? * *"/>
</cc:staticfile-in>
<cc:http-out id="httpCheck" endpoint="http://dink.capeclear.com/"/>
<cc:xmpp-out id="xo" endpoint="xmpp:someOperator@gmail.com"
username="someUser" password="somePassword"
server="talk.google.com" domain="gmail.com"/>
<cc:send-error id="sendError" routes-to="xo"/>
</cc:assembly>
</beans>
It sets up a static-file event (running every 10 seconds according to a cron schedule). This event creates a static message which is routed to a HTTP-out transport (see routes-to attribute of static-file-in). The http-out transport is used to ping some URL (in this case dink.capeclear.com). If this ping fails, then an error handler (sendError) is automatically invoked. This sendError command routes a message to GoogleTalk IM (xmpp-out).
The result is that if dink.capeclear.com is not available, someone gets an IM message on googleTalk.
Powered by ScribeFire.


2 Comments:
I'm not a regular reader of your blog. What do you mean by assemblies?
Thanks in advance,
I work for a company called Cape Clear and the next version of the product supports a thing we call an assembly, which is a way to build a SOA application by wiring together transports and processing steps in a single Spring-based XML file.
Post a Comment
<< Home