Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6085565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:39:10+00:00 2026-05-23T11:39:10+00:00

If I enable transaction management on my DefaultMessageListenerContainer by specifying sessionTransacted=true or transactionManager=jmsTransactionManager ,

  • 0

If I enable transaction management on my DefaultMessageListenerContainer by specifying sessionTransacted=true or transactionManager=jmsTransactionManager, whenever an exception occurs in the MDP, the transaction is rolled back and the message is placed back on the queue. That then causes the message to be processed again, the transaction to roll back again over and over again so that it creates an endless loop.

I guess my question is … what am I missing here? Why would you want the message to go back on the queue if it just means it will be processed over and over again?

<!-- jms connection factory -->
<bean name="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:ConnectionFactory" />
</bean>

<!-- jms transaction manager -->
<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>

<!-- Destination for Inbound_Email_Q -->
<bean name="inboundEmailDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="queue/inbound_Email_Queue" />
</bean>

<!-- JmsTemplate for Inbound_Email_Q -->
<bean name="jmsInboundEmailTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsConnectionFactory" />
    <property name="defaultDestination" ref="inboundEmailDestination" />
    <property name="messageConverter" ref="xmlMessageConverter" />
</bean>

<!-- jms asynchronous listener -->
<bean id="emailMessageServiceMdp" class="org.site.wso.core.jms.EmailMessageServiceMdp" />
<bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <!-- <property name="transactionManager" ref="jmsTransactionManager" />  -->
    <!-- <property name="sessionTransacted" value="true"/>  -->
    <property name="destination" ref="inboundEmailDestination"/>
    <property name="messageListener" ref="messageListener"/>
</bean>

<!-- jms message listener adapter -->
<bean id="messageListener" class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
    <constructor-arg>
        <bean class="org.site.wso.core.jms.EmailMessageServiceMdp"/>
    </constructor-arg>
    <property name="messageConverter" ref="xmlMessageConverter"/>
</bean>

And here is my MDP:

public class EmailMessageServiceMdp implements MessageDelegate {

    public void handleMessage(Object object) {

        EmailMessageRequestVO requestVO = (EmailMessageRequestVO) object;   

        try {
            //Service call that throw exception
        } catch (Exception e) {
            throw new ApplicationException(e);
        }

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:39:11+00:00Added an answer on May 23, 2026 at 11:39 am

    The message redelivery is simply the default behaviour for your [configured] JMS implementation. It’s up for endless debate what the relative usefulness of this is, but it would seem that rather than discard a message with some potentially unrecoverable data, some sort of retry is a sensible and conservative approach. For example, in your case, you appear to be converting a JMS message to an email message and dispatching to an SMTP server. If the SMTP gateway is down, you might want to hold onto the JMS messages and reprocess them when the gateway comes back up.

    In general I would say your options for handling a message that failed processing are (depending on the JMS implementation):

    1. Ditch the message.
    2. Write the message to an error queue.
    3. Redeliver the message after a delay of n seconds.
    4. Redeliver the message n times and then write the message to an error queue.
    5. Redeliver the message after a delay of n seconds x times and then write the message to an error queue.

    If you prefer #1, then simply suppress the exception, commit the transaction and wave good bye to the message. For the rest, the JMS configuration (or the destination specific configuration) should handle those.

    Additionally, if you want something more specific, you can interrogate the message’s getJMSRedelivered() and/or the implementation specific message header property that indicates how many times the message has been redelivered (supported by most JMS implementations, but not standard) and dispose of the message accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a Django program, how to explicitly disable auto transaction management before hundreds of
I want to roll back a transaction named scope but the inner transaction named
To enable single sign-on for a web application and a web application in a
I want to enable an user to be able to communicate with other users
I am trying to enable Full-text indexing in SQL Server 2005 Express. I am
I need to enable/disable completely network interfaces from a script in Windows XP. I'm
I would like to enable/disable some code based on a custom solution configuration I
How do I enable external access to MySQL Server? I can connect locally but
I'd like to enable/disable some other controls based on how many items are in
In our application we enable users to print pages. We do this by supplying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.