activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vineetc <vinicha...@gmail.com>
Subject SM + AMQ + Jencks with DeadLetterQueue
Date Mon, 26 Jun 2006 22:03:18 GMT

Hello,
I have built SerivceMix JBI JMS components using ComponentSupport which are
essentially extensions of JmsInBinding and JmsInUsingJcaBinding for sending
and recv. JMS meesages using AMQ 3.2 and Jecnks 1.1.1.
Sending and Receiving (using JCA) JMS messages work fine but i am having
troubles with redelivery and setting up DLQ.
For test purposes i throw out runtime exception from onMessage() method of
the listener for the message sent. Although the spec JMS says its an error
to throw RuntimeException its easier to just test the use case of redelivery
and dead letter Q. From the log it looks like the message is neither getting
redelivered nor sent to DLQ.

Following are the exceprts from the AMQ broker, Receiver and sender
component XML files.

RECEIVER:
<beans>
       <!-- primary Q handling the messages -->
        <bean id="activationSpec"
class="org.activemq.ra.ActiveMQActivationSpec">
                <property name="destination"
value="org.wkhmr.cornerstone.business.intell.stats.jms.q" />
                <property name="destinationType" value="javax.jms.Queue" />
        </bean>
       <!-- dead letter Q for handling poisoned messages -->
        <bean id="dlqActivationSpec"
class="org.activemq.ra.ActiveMQActivationSpec">
                <property name="destination"
value="org.wkhmr.cornerstone.business.intell.stats.jms.dlq" />
                <property name="destinationType" value="javax.jms.Queue" />
        </bean>
        <!-- the JCA container -->
        <bean id="jencks" name="jcaContainer"
class="org.jencks.JCAContainer" singleton="true">
                <property name="bootstrapContext">
                        <bean
class="org.jencks.factory.BootstrapContextFactoryBean">
                                <property name="threadPoolSize" value="18"
/>
                                <property name="transactionManager"
ref="transactionManager"/>
                        </bean>
                </property>
                <!-- the JCA Resource Adapter -->
                <property name="resourceAdapter">
                        <bean id="activeMQResourceAdapter"
class="org.activemq.ra.ActiveMQResourceAdapter" singleton="true">
                                <property name="serverUrl">
                                        <value>tcp://localhost:61616</value>
                                </property>
                                <property name="endpointWorkerType"
value="asf"/>
                        </bean>
                </property>
        </bean>
       
        <bean id="transactionManager"
class="org.jencks.factory.TransactionManagerFactoryBean"/>
        <bean id="transactionContextManager"
class="org.jencks.factory.TransactionContextManagerFactoryBean" />
</beans>.

SENDER:
<beans>
        <!-- message broker -->
        <bean id="broker" class="org.activemq.spring.BrokerFactoryBean">
                <property name="config"
value="file:C:/etc/opt/cornerstone/bus-intell/stats/statsActiveMQ.xml" />
        </bean>
       
        <bean id="jmsFactory"
class="org.activemq.pool.PooledConnectionFactory">
                <property name="connectionFactory">
                        <bean
class="org.activemq.ActiveMQConnectionFactory">
                                <property name="brokerURL">
                                        <value>tcp://localhost:61616</value>
                                </property>
                        </bean>
                </property>
        </bean>
       
        <bean id="template"
class="org.springframework.jms.core.JmsTemplate">
                <property name="connectionFactory">
                        <ref local="jmsFactory" />
                </property>
                <property name="defaultDestinationName"
value="org.cornerstone.business.intell.stats.jms.q" />
                <property name="pubSubDomain" value="false" />
                <!--  transactional properties -->
                <property name="sessionTransacted" value="true" />
                <property name="sessionAcknowledgeMode" value="0"/>
</beans>

AMQ Broker Config Xml:
<beans>
  <broker name="StatsBroker">
    <connector>
      <tcpServerTransport uri="tcp://localhost:61616" backlog="999"
useAsyncSend="true" maxOutstandingMessages="45">
              <wireFormat class="org.activemq.io.impl.DefaultWireFormat"/>
      </tcpServerTransport>
    </connector>

    <persistence><vmPersistence></vmPersistence>
    </persistence>
   
    <redeliveryPolicy backOffMode="true" maximumRetryCount="1">
    </redeliveryPolicy>
   
       <deadLetterPolicy 
    	deadLetterEnabled="true"
    	storeNonPersistentMessages="true"
    	deadLetterPerDestinationName="false"
    	deadLetterPrefix="org.wkhmr.cornerstone.business.intell.stats.jms."
    	deadLetterName="dlq"
    	allowDuplicates="false" >
    	<!--     			
    			deadLetterQueueTTL="120000" deadLetterTopicTTL="120000" ONLY when we
need to expire messages
    			 useDatabaseLocking="true" ONLY When JDBC persistence is enabled 
    	-->
    </deadLetterPolicy>
   
  </broker>

Both the sender and receiver files correspond to separate JBI components for
sending and receiving.
I also had problems with the using GeronimoTransactionManagerFactoryBean.
The problem reported was that the object returned by the bean is not of type
ExtendedtransactionManager.

Following is the stacktrace for the exception:

2006-06-26 00:03:23,625  INFO [Thread-36] ActiveMQSession:572 - Caught
:java.lang.RuntimeException: javax.jms.JMSException: Message id 3 should be
picked up on DLQ
java.lang.RuntimeException: javax.jms.JMSException: Message id 3 should be
picked up on DLQ
	at
com.wkhmr.cornerstone.bi.stats.binding.jms.base.StatsJmsInBinding.onMessage(Unknown
Source)
	at org.jencks.XAEndpoint.onMessage(XAEndpoint.java:126)
	at
org.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:136)
	at
org.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:75)
	at org.activemq.ActiveMQSession.deliver(ActiveMQSession.java:568)
	at org.activemq.ActiveMQSession.run(ActiveMQSession.java:550)
	at org.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:595)
Caused by: javax.jms.JMSException: Message id 3 should be picked up on DLQ
	at
com.wkhmr.cornerstone.bi.stats.binding.jms.StatsReceiver.processReceviedMessage(Unknown
Source)
	... 10 more

I have tried hunting thru the Jecks website but culdnt find anything related
to handling Redelivery or DLQ.
Any insight into where or what i am doing wrong?
Thanks in advance for your help.
Vineet
--
View this message in context: http://www.nabble.com/SM-%2B-AMQ-%2B-Jencks-with-DeadLetterQueue-t1851775.html#a5055822
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message