Hi,

Thanks to the availability of the Maven artifacts with the 0.10 release I've been able to finalize the library to do Hessian remote procedure calls over AMQP. A documentation is available with complete code examples on Github:

http://ebourg.github.com/qpid-hessian

The library is also available through Maven.

  <dependency>
    <groupId>org.apache-extras.qpid</groupId>
    <artifactId>qpid-hessian</artifactId>
    <version>1.0</version>
  </dependency>

Emmanuel Bourg


Le 26/05/2010 14:01, Emmanuel Bourg a écrit :
Hi,

I've done some request/response work with Qpid lately, and I implemented
a Hessian layer to make it easier. I'd like to share it here if ever
someone find it useful. The source code is available there:

http://github.com/ebourg/qpid-hessian


If you've already worked with Hessian to do RPC over HTTP the principle
is almost identical:

1. Create an interface defining the methods exposed:

public interface EchoService {
String echo(String message);
}


2. Implement the interface and extend the HessianEndpoint class
(this is the equivalent of the HessianServlet):

public class EchoServiceEndpoint extends HessianEndpoint
implements EchoService {

public String echo(String message) {
return message;
}
}


3. Deploy the endpoint by attaching it to a Qpid session:

EchoServiceEndpoint endpoint = new EchoServiceEndpoint();
endpoint.run(session);


4. On the client side, create a proxy of the interface:

AMQPHessianProxyFactory factory = new AMQPHessianProxyFactory();
EchoService service = factory.create(EchoService.class,
"qpid://guest:guest@localhost/test");


5. The service is ready to be consumed!

String echo = service.echo("Hello Qpid!");



Emmanuel Bourg



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to