aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lin Sun <linsun....@gmail.com>
Subject [message driven service] integration with blueprint
Date Mon, 02 Aug 2010 19:00:56 GMT
Hi

A while back ago, I sent an update about the message-driven service
prototype I have been working on.   For the past few weeks, I have
updated the code to provide blueprint message driven services.
Basically, this means -

1. Users can use the message-driven elements to register their message
driven services in blueprint XML definition file.  Here is an example
-

	<md:message-driven id="myMessageDrivenBean"
		class="org.apache.aries.mds.sample.MyMessageDrivenBean"
		destroy-method="destory" interface="javax.jms.MessageListener">
		<md:activationConfig>
			<md:entry key="destination" value="Hello.Queue" />
			<md:entry key="destinationType" value="javax.jms.Queue" />
		</md:activationConfig>
		<md:transaction value="Required" />
		<md:argument ref="connectionFactory" />

	</md:message-driven>


which is equivalent to:

    <bean id="myMessageDrivenBean"
class="org.apache.aries.mds.sample.MyMessageDrivenBean"
destroy-method="destory">
        <argument ref="connectionFactory" />
    </bean>

    <service ref="myMessageDrivenBean" interface="javax.jms.MessageListener">
		<service-properties>
                        <!-- for the activation config properties add
the relevant prefix to the property name -->
			<entry key="org.apache.aries.message.driven.destinationType"
value="javax.jms.Queue" />
			<entry key="org.apache.aries.message.driven.destination"
value="Hello.Queue" />
			<!-- transaction attribute based on the tx:transaction element in
blueprint -->
                        <entry
key="org.apache.aries.message.driven.transactionAttribute"
value="Required"/>
		</service-properties>
	</service>


When the message-driven name space handler is invoked to parse the
message-driven element, it will create the bean metadata and service
metadata and register them in the component definition registry.

2. For transaction, I tried to reuse what we defined for declarative
transaction except that I try to keep it very simple.  You can only
specify bean level transaction with all methods having the same
transaction inside the message-driven service.  Similar as EJB
message-driven beans, only Required and NotSupported transaction
attributes are supported.   The blueprint transaction name space
handler is not being used here, instead the message-driven name space
handler is used to parse the transaction element here as we need to
convert it to the org.apache.aries.message.driven.transactionAttribute
service property so that the message-driven service container can
handle the transaction before and after the message is delivered.

Comments are welcome!

Lin

Mime
View raw message