/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
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;
/**
 * MessageBeanImpl.java
 *
 *
 * Created: Sat Nov 25 18:07:50 2000
 *
 * @author Peter Antman DN <peter.antman@dn.se>
 * @version
 */

public class ExQueueBean implements MessageDrivenBean, MessageListener{

   org.apache.log4j.Category log = org.apache.log4j.Category.getInstance(getClass());
   
    private MessageDrivenContext ctx = null;
    public ExQueueBean() {
	
    }
    public void setMessageDrivenContext(MessageDrivenContext ctx)
	throws EJBException {
	this.ctx = ctx;
    }
    
    public void ejbCreate() {}

    public void ejbRemove() {ctx=null;}

    public void onMessage(Message message) {
       log.debug("ExQueueBean rolling back transaction" + message.toString());
       ctx.setRollbackOnly();
    }
} // MessageBeanImpl



