The Source for Java Technology Collaboration
Webmaster Alert: Posting to Jive Forums is currently not working. Estimated time for fix is unknown.

Home » java.net Forums » GlassFish » GlassFish

Thread: how can i setup glassfish to deal with "poison message"

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 9 - Last Post: Oct 8, 2009 8:20 AM by: Paulo Cesar Reis
seeglow

Posts: 9
how can i setup glassfish to deal with "poison message"
Posted: Jan 15, 2009 2:13 AM
  Click to reply to this thread Reply

do glassfish have options to set "redelivery count" or "dead message queue"?
or how glassfish deal with "poison message"?

thanks a lot.

seeglow

Posts: 9
Re: how can i setup glassfish to deal with "poison message"
Posted: Jan 15, 2009 5:14 PM   in response to: seeglow
  Click to reply to this thread Reply

Can anybody help me?
my message listener throw a exception,
and glassfish go into dead loop of throwing exception, unless i disable the MDB.

Steve Essery
Re: how can i setup glassfish to deal with "poison message"
Posted: Jan 16, 2009 4:44 AM   in response to: seeglow
  Click to reply to this thread Reply

Hi,

You should be able to control this with the activation-config in the
sun-ejb-jar.xml file. There are the endpointExceptionRedeliveryAttempts
and the sendUndeliverableMsgsToDMQ properties:

http://docs.sun.com/app/docs/doc/820-6740/aeoon?a=view

Disclaimer: I've not tried this myself.

Regards,
Steve

glassfish@javadesktop.org wrote:
> Can anybody help me?
> my message listener throw a exception,
> and glassfish go into dead loop of throwing exception, unless i disable the MDB.
> [Message sent by forum member 'seeglow' (seeglow)]
>
> http://forums.java.net/jive/thread.jspa?messageID=326369
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net


seeglow

Posts: 9
Re: how can i setup glassfish to deal with "poison message"
Posted: Jan 18, 2009 5:34 PM   in response to: Steve Essery
  Click to reply to this thread Reply

thank you! i will check if it works soon.

jlalwnai

Posts: 1
Re: how can i setup glassfish to deal with "poison message"
Posted: Feb 6, 2009 7:02 AM   in response to: seeglow
  Click to reply to this thread Reply

I am having the same problem. I set the endpointExceptionRedeliveryAttempts using annotations, but the messages keep getting redelivered

Here's the code

package jms;

import javax.annotation.Resource;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.ejb.ActivationConfigProperty;


/**
* Message-Driven Bean implementation class for: MessagingMDB
*
*/
@MessageDriven(
mappedName = "jms/DTNQueue", activationConfig =
{
@ActivationConfigProperty(propertyName = "endpointExceptionRedeliveryAttempts", propertyValue = "1")

})
public class MessagingMDB implements MessageListener {

@Resource
private MessageDrivenContext mdc;
/**
* Default constructor.
*/
public MessagingMDB() {
// TODO Auto-generated constructor stub
}

/**
* @see MessageListener#onMessage(Message)
*/
public void onMessage(Message message) {
TextMessage msg = null;
try {
if(message instanceof TextMessage)
{
msg = (TextMessage) message;
System.out.println("Message received : " + msg.getText());
if("DTNdie".equalsIgnoreCase(msg.getText())) throw new Exception("CROAK!!!");
}
else
{
System.out.println("Non text message recieved " + message.toString());
}

} catch (Exception e) {
e.printStackTrace();

mdc.setRollbackOnly();
}

}

}

Message was edited by: jlalwnai

scotty76

Posts: 5
Re: how can i setup glassfish to deal with "poison message"
Posted: Mar 4, 2009 2:28 AM   in response to: jlalwnai
  Click to reply to this thread Reply

I've looked into this a little more and have found that if I throw an Exception out of onMessage then the retry value is honoured. Like this:

public void onMessage(Message msg) {
try {
.....
} catch (Throwable ex) {
// Force a transaction rollback and redelivery
messageDrivenContext.setRollbackOnly();
throw new RuntimeException(ex);
}

I thought you were always meant to use setRollbackOnly() ?

If the code is:

public void onMessage(Message msg) {
try {
.....
} catch (Throwable ex) {
// Force a transaction rollback and redelivery
messageDrivenContext.setRollbackOnly();
}

The message retries forever until I purge the Queue. Incidentally the above code works fine in Weblogic 9. :-)

stenlee

Posts: 3
Re: how can i setup glassfish to deal with "poison message"
Posted: Feb 28, 2009 1:17 PM   in response to: seeglow
  Click to reply to this thread Reply

the same problem here. endpointExceptionRedeliveryAttempts is not helping :(. Property seems to be ignored in annotation and also in sun-ejb-jar.xml. Have somebody a solution ?

scotty76

Posts: 5
Re: how can i setup glassfish to deal with "poison message"
Posted: Mar 4, 2009 1:35 AM   in response to: stenlee
  Click to reply to this thread Reply

Did anyone find any solutions for this?

Also is this the right section to add to <ejb></ejb> in sun-ejb-jar.xml ?

<mdb-resource-adapter>
<resource-adapter-mid>jmsra</resource-adapter-mid>
<activation-config>
<activation-config-property>
<activation-config-property-name>endpointExceptionRedeliveryAttempts</activation-config-property-name>
<activation-config-property-value>3</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>sendUndeliverableMsgsToDMQ</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
</activation-config>
</mdb-resource-adapter>

vijay_5

Posts: 2
Re: how can i setup glassfish to deal with "poison message"
Posted: Oct 8, 2009 4:55 AM   in response to: seeglow
  Click to reply to this thread Reply

We are also having the same problem. works only if you throws exception out of onMessage. Any idea?

Paulo Cesar Reis
Re: how can i setup glassfish to deal with "poison message"
Posted: Oct 8, 2009 8:20 AM   in response to: vijay_5
  Click to reply to this thread Reply

Try to set the max redeliver time to 1 in yours MDB's.


On 10/8/09 8:55 AM, "glassfish@javadesktop.org" <glassfish@javadesktop.org>
wrote:

> We are also having the same problem. works only if you throws exception out of
> onMessage. Any idea?
> [Message sent by forum member 'vijay_5'
> (vijayaraghavan.subramaniam@wipro.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=367272
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net





 XML java.net RSS