hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Jakarta-hivemind Wiki] Update of "UsingSpringRemoting" by robortluo
Date Wed, 03 Aug 2005 13:06:18 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-hivemind Wiki" for change

The following page has been changed by robortluo:

New page:
== Problem ==

You want to access a remote service by RMI or web service transparently.

== Idea ==

Obviously there should be a ''remoting'' implementation instead of normal ''local'' implementation
of your service. However, we still need to write code to do real thing. Why reinvent wheels?
There is a package named spring-remoting in spring framework, it handle this problem well,
and the solution has been proved. Let's make it hivemind way!

== Solution ==

First, a service point to provide service like usual:
    <service-point id="FinanceService" interface="mypackage.FinanceService"/>

Then, a remote implementation:

    <service-point id="rmiFinanceInterceptor" 
            <construct class="org.springframework.remoting.rmi.RmiClientInterceptor">
                <set property="serviceUrl" value="rmi://myserver:1399/financeService"/>
                <set-object property="serviceInterface"
    <implementation service-id="mypackage.FinanceService">
       <invoke-factory service-id="hivemind.lib.PlaceholderFactory"/>
       <interceptor service-id="hivemind.lib.MethodInterceptorFactory">
           <impl object="service:rmiFinanceInterceptor"/>

That's it! The magic here is the hivemind.lib.!MethodInterceptorFactory service, it opens
the door to spring interceptors. In this way, we can even use spring transaction package to
declare hivemind transactional service!

== How about go further ==

Make a !ServiceImplementationFactory (let's name it ''RMI!RemotingServiceFactory'') to declare
the service easier and cleaner, so we can do:

    <implementation service-id="mypackage.FinanceService">
        <invoke-factory service-id="hivemind.contrib.RMIRemotingServiceFactory">
            <remote url="rmi://myserver:1399/financeService"/>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message