views:

6

answers:

0

Hi all, I`am using jboss-5.0.0.GA-jdk6.

Ive implemented a JMS que, and MDB which listens to it.(so far so good)

What im trying to achive is: after 3 attempts of errors, instead of sending the error msg to DLQ, i wanna send it to a new custom Error Que which I want to define, so I can handle the errors in that que the way I want.

any idea how to code this idea?

here is some code of what ive done:

here I conifgure my jms:

at destinations-service.xml:

 <mbean  code="org.jboss.jms.server.destination.QueueService" 
       name="jboss.messaging.destination:service=Queue,name=MyQueue" 
       xmbean-dd="xmdesc/Queue-xmbean.xml">  
       <depends optional-attribute-name="ServerPeer">  
            jboss.messaging:service=ServerPeer  
       </depends>  
       <depends>
            jboss.messaging:service=PostOffice
        </depends>  
        <attribute name="JNDIName">queue/MyQueue</attribute>  
        <attribute name="RedeliveryDelay">10000</attribute>  
        <attribute name="MaxDeliveryAttempts">3</attribute>  
 </mbean> 

And this way ive configured my MDB: (only by injection)

package com.test.mdb;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.EJBException;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.Message;
import javax.jms.MessageListener;


    @MessageDriven (mappedName = "queue/MyQueue", activationConfig = {

    @ActivationConfigProperty (propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),

    @ActivationConfigProperty (propertyName = "destination", propertyValue ="queue/MyQueue"),

    @ActivationConfigProperty (propertyName = "destinationType", propertyValue = "javax.jms.Queue")})


     public class MyMdb implements MessageListener, MessageDrivenBean

{

/**
 * 
 */
private static final long serialVersionUID = 1L;

public void ejbCreate () 
{

}

public void onMessage(Message msg) 
{

    System.out.println("MDB: ive got message from jms Jboss ");
              //now i am trying to fail the transaction for test purpose.
    throw new EJBException(); 

}

public void ejbRemove() throws EJBException {
    // TODO Auto-generated method stub

}

public void setMessageDrivenContext(MessageDrivenContext arg0)
        throws EJBException {


}

}

Thanks in advance,

ray.