On 17 Aug, Hiram Chirino wrote:
> 
> 
>>Problem is here:
>>
>>Is it not so, that the only way to ack the message (inspite of the fact
>>that it should be marked as roolback) to actually do a trans.commit()
>>here.
>>
>>But this is not possible, since that would also try to commit any faulty
>>bean, or am I wrong here.
>>
>>Or is it possible to delist the XAResource, start a new transaction and
>>make that commit?
>>
>>In that case we could probably do dead queue handling here.
>>
> 
> ah..  I see the problem..  I guess an easier way to do dead letter handling 
> is to make sure jboss mq is marking its message resends and when the Invoker 
> sees that a message has been resent x times, then it bypasses the bean and 
> places it on the dead letter queue.
> 
> Regards,
> Hiram
> 

OK, I get it (I think).

Pseudocode:

In JMSContainerInvoker:

 public void onMessage(final Message message)
      {
         // assert message != null;

         if (log.isDebugEnabled()) {
            log.debug("processing message: " + message);
         }

Here is the new logic:
         if(message.getJMSRedelivered()) {
              id = message.getJMSMessageID();
              if ( idchecker.howManyTimesRedelivered(id ) > maxRedeliver) {
                 placeMessageOnDeadLetterQueue( message );
                 return;// The bean is never invoked - will transaction be OK
              }
         }
        

         Object id;
         try {
            id = message.getJMSMessageID();
         } catch (JMSException e) {
            // what ?
            id = "JMSContainerInvoker";
         }

         // Invoke, shuld we catch any Exceptions??
         try {
            invoker.invoke(id,                     // Object id - where used?
                           ON_MESSAGE,             // Method to invoke
                           new Object[] {message}, // argument
                           tm.getTransaction(),    // Transaction
                           null,                   // Principal
                           null);                  // Cred
         }
         catch (Exception e) {
            log.error("Exception in JMSCI message listener", e);
         }
      }

//Peter
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> 
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development

-- 
Jobba hos oss: http://www.tim.se/weblab
------------------------------------------------------------
Peter Antman             Technology in Media, Box 34105 100 26 Stockholm
Systems Architect        WWW: http://www.tim.se
Email: [EMAIL PROTECTED]        WWW: http://www.backsource.org
Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942 
------------------------------------------------------------


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to