activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject RE: MDB in Spring
Date Mon, 26 Mar 2007 21:13:11 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii" plain; text 
Content-Type: 7bit Content-Transfer-Encoding:>
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=120210421-26032007><FONT face=Arial 
color=#0000ff size=2>Here is an example from my applications configuration. It's 
rather simple. There is no MDB interface that needs to be implemented.&nbsp;I 
managed to implement this by looking through the Spring documentation. I'm using 
Bitronix as my Transaction Manager so the Connection Factory Bean is a BTM class 
that wraps the ActiveMQ Connection Factory and manages a Pool of Connections. 
With some minor changes you should be able to get this to work for you 
application.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=120210421-26032007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV><SPAN 
class=120210421-26032007><FONT face=Arial color=#0000ff size=2>
<DIV dir=ltr align=left><BR>&nbsp; &lt;!-- A class that will process the

received javax.jms.TextMessage --&gt;<BR>&nbsp; &lt;bean 
id="orderMessageListener" 
class="org.springframework.jms.listener.adapter.MessageListenerAdapter"&gt;<BR>&nbsp;&nbsp;&nbsp;

&lt;constructor-arg&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;bean 
class="com.sybase.it.cosmos.jms.impl.OrderRequestMessageListenerImpl" 
autowire="byName"/&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;/constructor-arg&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;property

name="defaultListenerMethod" value="submitPip3A4PurchaseOrderRequest" 
/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;property 
name="messageConverter"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&lt;null/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/property&gt;<BR>&nbsp;

&lt;/bean&gt;<BR>&nbsp; <BR>&nbsp; &lt;!-- <BR>&nbsp;&nbsp;
- a kind of message 
listener pool that will listen to messages posted to 'requestQueue', 
<BR>&nbsp;&nbsp; - each one consuming a connection from bean 'ConnectionFactory'

<BR>&nbsp; --&gt;<BR>&nbsp; &lt;bean id="OrderListenerContainer"

class="org.springframework.jms.listener.DefaultMessageListenerContainer"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&lt;property name="transactionManager" ref="transactionManager" 
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connectionFactory"

ref="jmsConnectionFactory" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;property 
name="messageListener" ref="orderMessageListener" 
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="destinationName"

value="${jms.order.request.queue.physicalName}" 
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="concurrentConsumers"

value="10" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property

name="receiveTimeout" value="3000" /&gt;<BR>&nbsp; &lt;/bean&gt;<BR>&nbsp;

<BR>&nbsp; &lt;!-- The JMS Template is used for sending confirmation documents

to the response queue. --&gt;<BR>&nbsp; &lt;bean id="jmsTemplate" 
class="org.springframework.jms.core.JmsTemplate"&gt;<BR>&nbsp;&nbsp;&nbsp;

&lt;property name="connectionFactory" ref="jmsConnectionFactory" 
/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;property name="defaultDestinationName"

value="${jms.order.confirm.queue.physicalName}"/&gt;<BR>&nbsp;&nbsp;&nbsp;

&lt;property name="sessionTransacted" value="true"/&gt;<BR>&nbsp;&nbsp;&nbsp;

&lt;property name="deliveryPersistent" value="true"/&gt;<BR>&nbsp; 
&lt;/bean&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><BR>&nbsp;&lt;!-- The JMS Connection Factory.
Creates 
the Connections --&gt;<BR>&nbsp; &lt;bean id="jmsConnectionFactoryBean"

class="bitronix.tm.resource.jms.ConnectionFactoryBean"&gt;<BR>&nbsp;&nbsp;&nbsp;

&lt;property name="className" value="${jms.connection.factory.className}" 
/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;property name="uniqueName" 
value="${jms.connection.factory.unique.name}" /&gt;<BR>&nbsp;&nbsp;&nbsp;

&lt;property name="poolSize" value="10" /&gt;<BR>&nbsp;&nbsp;&nbsp;
&lt;property 
name="driverProperties"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&lt;props&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;prop 
key="brokerURL"&gt;${jms.connection.factory.brokerUrl}&lt;/prop&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&lt;/props&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/property&gt;<BR>&nbsp;

&lt;/bean&gt;&nbsp;&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp; &lt;!-- The JMS Connection Factory. Utilizes
the 
Connection Factory Bean and creates the Connections --&gt;<BR>&nbsp; &lt;bean

id="jmsConnectionFactory" factory-bean="jmsConnectionFactoryBean" 
factory-method="createResource" /&gt;<BR></FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> "Karthik.Gopalakrishnan" 
&lt;karthik.gopalakrishnan@caritor.com&gt; [mailto:"Karthik.Gopalakrishnan" 
&lt;karthik.gopalakrishnan@caritor.com&gt;] <BR><B>Sent:</B> Monday,
March 26, 
2007 1:05 PM<BR><B>To:</B> users@activemq.apache.org<BR><B>Subject:</B>
Re: MDB 
in Spring<BR></FONT><BR></DIV>
<DIV></DIV><BR>Isnt there someone who has already done a similar thing !!!!

<BR>Please reply <BR><BR><BR>Karthik.Gopalakrishnan wrote: <BR>&gt;
<BR>&gt; Hi 
<BR>&gt; <BR>&gt; I want to use spring to be used to configure ActiveMQ
<BR>&gt; 
right from creating a broker, queue and to make an MDB listen to the <BR>&gt; 
queue.Which is the right place to start ? I dont understand the details <BR>&gt;

given in http://activemq.apache.org/spring-support.html properly.There is 
<BR>&gt; no mention of a MDB which listens to a particular destination. Do we 
have <BR>&gt; a sample spring configuration file which does all this ?If not can

you <BR>&gt; please let me know what are the necessary things that a spring file

should <BR>&gt; be having to do the following : <BR>&gt; <BR>&gt;
1) want to 
create an embedded broker. <BR>&gt; 2) A queue . <BR>&gt; 3) A MDB which
listens 
to the queue which was <BR>&gt; just created. <BR>&gt; <BR>&gt;
<BR>&gt; Thanks 
in advance <BR>&gt; <BR>&gt; <BR><BR>-- <BR>View this
message in context: 
http://www.nabble.com/MDB-in-Spring-tf3468525s2354.html#a9680268 <BR>Sent from 
the ActiveMQ - User mailing list archive at Nabble.com. 
<BR><BR><BR></BODY></HTML>


Mime
View raw message