synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sadeep Jayasumana <gayansad...@gmail.com>
Subject Support for calling external EJBs during mediation
Date Thu, 05 Jul 2012 02:12:04 GMT
Hi devs,

Some months back I developed a new feature for Synapse that enables calling
remote EJB3.x components during message mediation. This introduces two new
mediators which are summarized below.

Bean mediator
---------------------
Bean mediator is used to manipulate a JavaBean (or simply, an object with
getter/setter methods) that is attached to the current message context as a
property. It can create/remove a JavaBean instance or set/get a property of
an existing JavaBean. This mediator serves the same purpose as <jsp:useBean
../>, <jsp:setProperty ../>, <jsp:getProperty ../> standard actions in JSPs.

Eg:
<bean action="CREATE" class="org.foo.bean.Location" var="loc"/>
<bean action="SET_PROPERTY" var="loc" property="latitude" value="37"/>
<bean action="GET_PROPERTY" var="store" property="name"
target="{//store/name/text()}"/>


EJB mediatior
---------------------
This mediator can call an external EJB using it's remote interface and
store the result in the message context or message body. It supports all
EJB3.x Session Bean types (Stateless, Stateful and Singleton). Note that
Message Driven Beans are already supported via Synapse's JMS transport
and Entity Beans are a candidate for pruning in Java EE 6. Therefore, with
this mediator, Synapse supports all EJB types.

Eg:
<ejb class="org.foo.ejb.StoreLocator" beanstalk="demo"
method="getClosestStore" target="store" jndiName="StoreLocator">
    <args>
        <arg value="2614"/>
    </args>
</ejb>


In addition to these two mediators, a new component named
EnterpriseBeanstalk is introduced. This implements the Java EE Service
Locator design pattern by caching JNDI results/EJB stubs to reduce network
calls while calling remote EJBs. Beanstalks have a automatic cache cleaning
mechanism and also provide a JMX interface for managing and monitoring.

The complete patch is attached to [1] along with a sample. I would like to
receive your feedback before committing this code to the trunk.

[1] https://issues.apache.org/jira/browse/SYNAPSE-838


Thanks,
-- 

Sadeep Jayasumana

**

Email: gayansadeep@gmail.com****

Mobile: +61 4 1468 8521

Mime
View raw message