com.mockrunner.example.jms.PrintMessageDrivenBean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Mockrunner is a lightweight framework for unit testing applications
in the J2EE environment. It supports servlets, filters, tag classes
and Struts actions. It includes a JDBC a JMS and a JCA test
framework and can be used to test EJB based applications.
The newest version!
package com.mockrunner.example.jms;
import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
/*
* @ejb:bean name="test/TestMessage"
* transaction-type="Container"
* acknowledge-mode="Auto-acknowledge"
* destination-type="javax.jms.Queue"
* subscription-durability="NonDurable"
*
* @ejb:transaction type="Required"
* @jboss:destination-jndi-name name="queue/testQueue"
*/
/**
* Receiver for {@link PrintSessionBean}.
*/
public class PrintMessageDrivenBean implements MessageDrivenBean, MessageListener
{
private MessageDrivenContext context;
public void onMessage(Message message)
{
if(message instanceof TextMessage)
{
//do print
}
}
public void setMessageDrivenContext(MessageDrivenContext context) throws EJBException
{
this.context = context;
}
public void ejbCreate()
{
}
public void ejbRemove()
{
}
}