First Jabber POC

On my current project I see some real future into messaging. I had some intensive discussions with my manager as he is more pro SOAP webservices then into messaging. But when you have push and pull mechanisms SOAP really isn’t the answer, what would you do? setup 2 SOAP services and let them communicate?? Well what if the specs change and a third party joins in? recode everything and if bla = true connect to X, else connect to Y? Really not!!!
What you can do is place a Queue where you publish everything on. You can use Jboss 4, it has one build in or if you want to go further you could use the Jabber protocol (same as google talk if I’m not mistaken). I have a jabber running on my server and did a very small test in java. I used the smack library, a small native java library. And I wrote this stupid little expample

public static void main(String[] args){
		try {
			XMPPConnection.DEBUG_ENABLED = true;
			SSLXMPPConnection.DEBUG_ENABLED = true;
			XMPPConnection con = new XMPPConnection("",5222);
			con.login("xxx", "xxx");
			PacketFilter filter = new PacketTypeFilter(Message.class);
			PacketCollector myCollector = con.createPacketCollector(filter);
			PacketListener myListener = new PacketListener(){
				public void processPacket(Packet pac){
		} catch (Exception e) {

What this stupid little example did was simply logon to my server, send me a message and listen for incoming messages. I ran this in debugmode with a breakpoint on the System.out.println line, when I replied to my message my breakpoint worked. I could inspect the message and see somewhere in the body my content wrapped in a jabber xml.

Off course it’s no rocket science, but it’s always nice when you see something spectaculair. 🙂

I’ll certainly use this in future projects. How exactly, hmm not yet sure 🙂

Leave a Reply