For fun I decided to develop a TwitterLogListener class for the jPOS Framework. It leverages JTwitter – the Java library for the Twitter API from Daniel Winterstein. With this, you can send alerts and/or messages to a twitter account for monitoring from a jPOS application.
You need to configure a TwitterLogListener in your logger:
<log-listener class="org.jpos.util.TwitterLogListener"> <property name="twitterUsername" value="paymentsystems" /> <property name="twitterPassword" value="SuperSecretPassword" /> <property name="tags" value="twitter" /> <property name="prefix" value="[jPOS]"/> </log-listener>
And you need to Log an event with a ‘twitter’ tag:
<script name="test" logger="Q2">
import org.jpos.util.*;
for (int i=0; qbean.running(); i++) {
LogEvent evt = log.createLogEvent ("twitter");
evt.addMessage ("This is a Twitter message test from jPOS! " + i);
Logger.log (evt);
Thread.sleep (10000L);
}
</script>
Look at the messages in a twitter account: http://twitter.com/paymentsystems
For more details on this see this post: http://is.gd/eDbI
Possibly Related Posts (automatically generated):


