Posts

Showing posts from 2010

Play with your byte-code using Javassist

I came to know about this nice tool named javassist which is a cool java byte code manipulation tool.It provides users with a very easy to use API to modify / create java classes in the Runtime. It provides some API to do that using a Java like syntax so that we can easily hack the byte code without knowing any thing in-depth about the byte code structure. In this blog post I'll explain you a simple example on how to use this tool.This will show how we can use javassist to change the byte code of a compiled class to change a method implementation in Runtime. Step 1 Download javassist library from http://sourceforge.net/projects/jboss/files/Javassist/3.14.0.GA/ Step 2 Create a new directory and copy javassist.jar to that directory. Step 3 Create Two java source file named HelloWorld.java and ByteCodeInjector.java in that directry HelloWorld.java public class HelloWorld { public static void main(String[] args) { new HelloWorld().sayHello(); } public void sayHello(){ ...

How to write a Axis2 Message Builder

Apache Axis2 is a open source SOAP/ Web services engine which consists of many extension points. Message Builders and Message Formatters are two ways we can extend the axis2 transport framework.In this post i’m going to explain the idea of Message builders and how we can implement a custom message builder and use it. As i mentioned above Axis2 is a SOAP engine. So it only accept SOAP messages for processing. So then a problem comes that how we can use axis2 with non-soap invocations like REST. So to convert row non soap content coming from a transport to a SOAP content we can use Message builders. This can really be useful when your in coming message have a non-xml format and you need to invoke a web service or process it with the axis2 engine with the given content information. Its simple to Write your own Message builder. First what you have to do is write a class implementing org.apache.axis2.builder.Builder interface in the Axis2 Kernal module. The Builder method signature we n...

Dead Letter Channel Enterprise Application Integration Pattern

Image
Dead Letter Channel Pattern belongs to the Category of Message Channel patterns which describes the Message transport level attributes. Idea of having a dead letter channel is to handle Message failures. Message failures can be occurred due to several reasons. Transport level failures Due to bad Configuration Message Expiration Problem with Message Consumer end In a failure Message will be routed to the dead letter channel. So that it can act as a Message archive mechanism , Re router or a special channel to process the bad messages. Having a Message archive system will be useful since later a Dead message can be viewed and re-delivered to the intended end point manually by a admin console.This will be useful to identify the Configuration problems Message Re-delivery is also a major part of a dead letter channel implementation. If we take a normal scenario like simple DB quarries or web-service calls some times a message will fail because of the endpo...