package org.jboss.test.mdb.bean;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.ejb.EJBException;
import javax.jms.MessageListener;
import javax.jms.Message;
import org.apache.log4j.Category;
public class TopicBean implements MessageDrivenBean, MessageListener{
private static final Category log = Category.getInstance(TopicBean.class);
private MessageDrivenContext ctx = null;
public TopicBean() {
}
public void setMessageDrivenContext(MessageDrivenContext ctx)
throws EJBException {
this.ctx = ctx;
}
public void ejbCreate() {}
public void ejbRemove() {ctx=null;}
public void onMessage(Message message) {
if (ctx.getRollbackOnly())
throw new IllegalStateException("Error in transaction");
log.debug("DEBUG: TopicBean got message" + message.toString() );
}
}