11 Replies Latest reply on Jan 23, 2006 4:35 AM by adrian.brock

    Message resent too many times

    chenna1978

      Hi,

      I am using jboss-3.2.1 to deploying message driven bean.
      It is working fine if my MDB don't throw any error.
      I am getting the following error when an exception is throws in MDB.

      14:25:17,171 WARN [DLQHandler] Message resent too many times; sending it to DLQ; message id=ID:6-11068538999531


      I read jboss documentation and unable to figure out the problem. Jboss sending message 10 times if MDB throws an exception
      and finally getting the above warning.
      By default jboss sends message 10 times if MDB throws an exeption. I tried to control this but not working.
      In standardjboss.xml file I used MaxTimesRedelivered = 1 (i.e I want to send message only once if there is any error in MDB).
      I don't want to send message 10 times if there is any error in MDB.
      Please can any one help me?

      Here is my standardjboss.xml and jboss.xml files.


      standardjboss.xml file
      **************************


      ...........
      ...............
      <container-configuration>
      <container-name>Standard Message Driven Bean</container-name>
      <call-logging>false</call-logging>
      <invoker-proxy-bindings>
      <invoker-proxy-binding>
      message-driven-bean
      <invoker-mbean>default</invoker-mbean>
      <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
      <proxy-factory-config>
      QueuehostJMSProvider
      StdJMSPool
      10
      30000
      50
      1

      10

      queue/DLQ
      1
      0


      </proxy-factory-config>
      </invoker-proxy-binding>
      </invoker-proxy-bindings>


      <container-interceptors>
      org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor
      org.jboss.ejb.plugins.LogInterceptor
      org.jboss.ejb.plugins.RunAsSecurityInterceptor
      <!-- CMT -->
      org.jboss.ejb.plugins.TxInterceptorCMT
      org.jboss.ejb.plugins.MetricsInterceptor
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      <!-- BMT -->
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT
      org.jboss.ejb.plugins.MetricsInterceptor
      org.jboss.resource.connectionmanager.CachedConnectionInterceptor
      </container-interceptors>

      <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
      <instance-cache></instance-cache>
      <persistence-manager></persistence-manager>
      <container-pool-conf>
      100
      </container-pool-conf>

      </container-configuration>

      </container-configurations>




      jboss.xml
      **************

      ...............
      ................
      <message-driven>
      <ejb-name>TestMDB</ejb-name>
      <destination-jndi-name>queue/testQueue1</destination-jndi-name>

      <invoker-bindings>

      <invoker-proxy-binding-name>message-driven-bean</invoker-proxy-binding-name>

      </invoker-bindings>
      </message-driven>

        • 1. Re: Message resent too many times

          As I have said a million times (ok maybe not a million)
          MDBs should not throw exceptions.

          When you use search to find those posts, maybe you'll begin to understand what is
          happening?

          • 2. Re: Message resent too many times
            chenna1978

            Hi,

            There may be a change to throw an exception in MDB because I am trying to connect to third party server in MDB.
            If third party server is down it will throw an exception.
            In that case how do I control the exception?

            Thanks.

            • 3. Re: Message resent too many times
              erik777

              bump... same question.

              • 4. Re: Message resent too many times
                • 5. Re: Message resent too many times
                  erik777

                  How about a link to information on how to:

                  1> Handle unavoidable exceptions in MDBs (highly unavoidable in today's distributed world where MDBs are expected to rely on remote services, such as the database, JNDI and web services.) I'm more than willing to catch these exceptions, if by catching I can ensure requirement #2:

                  2> Ensure 100% message reliability.

                  3> Avoid the DLQ.

                  Really, all of our questions are about #2. Reasons on why MDBs should or should not throw exceptions don't anwer question that brings us to this discussion.

                  I found the post I bumped by searching. I read the wiki on every topic and start my search there because it includes both the wiki and the forums. I probably searched for about half an hour before bumping this post. I probably missed something, but I'm not a deity, and am asking for help.

                  I did this search:

                  http://www.jboss.com/search.jsp?query=Adrian+exceptions+in+MDBs

                  and it only listed this thread.

                  If JBoss lacks features to support these requirements, it's better to say so and agree that these are good features for the next version. I don't believe hiding JBoss' shortcomings is productive or in JBoss' best interest. I, for one, have continued to give it my full support despite all the shortcomings I've been fully aware of since 2.4.0. I always said that one of the benefits of open source is open peer review leading to higher quality. This requires open discussion.

                  Erik Sliman
                  OpenStandards.net
                  JBoss user since September 2001 (2.4.0), currently developing in 4.0.2

                  • 6. Re: Message resent too many times

                     

                    "erik777" wrote:

                    I did this search:

                    http://www.jboss.com/search.jsp?query=Adrian+exceptions+in+MDBs

                    and it only listed this thread.


                    But obviously you didn't read the FAQ.

                    It is very simple. If you don't want to be ignored start your own thread for your own question.
                    And then if you don't want to be ignored, make sure you have read the documentation, faqs, etc.

                    • 7. Re: Message resent too many times

                       

                      "erik777" wrote:
                      How about a link to information on how to:

                      1> Handle unavoidable exceptions in MDBs (highly unavoidable in today's distributed world where MDBs are expected to rely on remote services, such as the database, JNDI and web services.) I'm more than willing to catch these exceptions, if by catching I can ensure requirement #2:


                      Force a rollback on error, which will happen anyway for RuntimeExceptions if the ejb transaction is linked to the delivery transaction (REQUIRED).


                      2> Ensure 100% message reliability.


                      Irrelevant


                      3> Avoid the DLQ.


                      If you don't want it to infinitely loop on the same error, then you need a DLQ
                      or some other mechanism to avoid JMS trying to redeliver after the rollback/nack.
                      e.g. redelivery delay in JBossMQ.

                      If this hasn't been discussed at least 100 times before in this forum, I am a "monkey's uncle".

                      • 8. Re: Message resent too many times
                        erik777

                        We have been using:

                        messageDrivenBeanContext.setRollbackOnly();


                        which is what the FAQ says to do. The problem is it goes to the DLQ, because if there is a network disconnect in a service the MDB needs, then naturally, the retries run out quickly, as they'll surely fail in the short-term.

                        Ideally, I'd like an infinite retry on network disconnection issues, with a delay, perhaps with a readable retry counter or elapsed time since initial retry so we could determine to escalate it after so long via a per MDB business process solution.

                        If you don't want it to infinitely loop on the same error, then you need a DLQ or some other mechanism to avoid JMS trying to redeliver after the rollback/nack.
                        e.g. redelivery delay in JBossMQ.


                        How can we programmatically throttle the redelivery delay of an individual message? I suspect there's a way, but couldn't figure it out and couldn't find it by searching. The only match I found by searching for "redelivery delay" was:

                        http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMessagingConfigurationAndManagementDesign

                        Here is our Destination Manager definition:

                         <mbean code="org.jboss.mq.server.jmx.DestinationManager" name="jboss.mq:service=DestinationManager">
                         <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache</depends>
                         <depends optional-attribute-name="PersistenceManager">jboss.mq:service=PersistenceManager</depends>
                         <depends optional-attribute-name="StateManager">jboss.mq:service=StateManager</depends>
                         </mbean>
                        


                        If we can't throttle on a per message level within the MDB when we rollback the tx, it would be less ideal but still helpful to be able to throttle at the queue or MQ service level.

                        This is not a new issue to us. For a previous service, to avoid the DLQ, if there is an exception, we programmatically stop the queue, and require user intervention to restart it when the problem is resolved. Unfortunately, as we increase our services, this becomes infeasible, particularly when server A is trying to send messages to server B, and server B is trying to send messages to server A. This isn't practical in all situations, and certainly never desirable.

                        Using JBoss search, I couldn't find anything on message or queue throttling. I searched for that too before bumping this thread.

                        Thank you in advance for your courteous reply.


                        • 9. Re: Message resent too many times

                           

                          "erik777" wrote:

                          Thank you in advance for your courteous reply.


                          The only reply you are going to get from me is read the docs (e.g. queue configuration)
                          then start your own thread.

                          Let me tell you a story (which makes me want to delete this thread).

                          I had a problem installing MySQL last month and I couldn't find the answer to the problem.
                          Why? Because everybody in MySQL just posted the same question over and over again.
                          Obviously the MySQL developers got bored of answering it (there were some answers that said "FAQ use search").

                          My inclination is to just delete all these duplicate questions by people like you that don't
                          search, read the docs and just dump useless questions in the forum.

                          That way there would be about 100 threads in this forum all pertinent, fully answered
                          and easy to find. Instead there are just hundreds of duplicates with the question answered
                          on maybe the first 1% that were posted completely hidden by the latter lazy users.

                          • 10. Re: Message resent too many times
                            erik777

                            I can understand your frustration with frequently asked questions on forums. Yet, ironically, I've read the docs (http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch6.chapt.html), I have a lot of experience with dealing with other issues with JBossMQ (such as memory management), I read the FAQs and I read everything I can find in the wiki that I though could be remotely pertinet to my issue. I still can't find an answer. Could I have missed something? Of course. I'm human.

                            I believe that the personal attacks and undue characterizations should be taken offline (via email), so I won't respond to them here.

                            • 11. Re: Message resent too many times

                               

                              "erik777" wrote:

                              I believe that the personal attacks and undue characterizations should be taken offline (via email), so I won't respond to them here.


                              They are not meant as personal attacks. They are a LART.
                              e.g. You *STILL* haven't stopped posting on somebody else's thread.

                              If my "friendly" requests to get you post properly don't work then I become more blunt.