newmessagebean.java

来自「精通NetBeans光盘源代码,很好很好的资料」· Java 代码 · 共 49 行

JAVA
49
字号
package org.netbeans.jms;

import javax.ejb.*;
import javax.jms.Message;
import javax.jms.MessageListener;

/**
 * This is the bean class for the NewMessageBean enterprise bean.
 * Created 2006-5-21 9:46:29
 * @author boyingking
 */
public class NewMessageBean implements MessageDrivenBean, MessageListener {
    private MessageDrivenContext context;
    
    // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
    
    /**
     * @see javax.ejb.MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)
     */
    public void setMessageDrivenContext(MessageDrivenContext aContext) {
        context = aContext;
    }
    
    /**
     * See section 15.4.4 of the EJB 2.0 specification
     * See section 15.7.3 of the EJB 2.1 specification
     */
    public void ejbCreate() {
        // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
    }
    
    /**
     * @see javax.ejb.MessageDrivenBean#ejbRemove()
     */
    public void ejbRemove() {
        // TODO release any resource acquired in ejbCreate.
        // The code here should handle the possibility of not getting invoked
        // See section 15.7.3 of the EJB 2.1 specification
    }
    
    // </editor-fold>
    
    public void onMessage(Message aMessage) {
        // TODO handle incoming message
        // typical implementation will delegate to session bean or application service
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?