All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.example.jms.PrintMessageDrivenBean Maven / Gradle / Ivy

Go to download

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()
    {
    
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy