mymsgdrivenbean.java
来自「一个java 代码生成器」· Java 代码 · 共 92 行
JAVA
92 行
package com.mdb;import javax.jms.*;import javax.ejb.*;import java.util.*;import java.math.*;/** * This is a MessageDrivenBean MyMsgDrivenBean class. * * @Author: Siddhartha P. Chandurkar * @version $ID: $ * */public class MyMsgDrivenBean implements MessageDrivenBean, MessageListener{ //Attributes MessageDrivenContext ejbContext; private String firstName; private String lastName; /** * Initializes the bean */ public void ejbCreate(){ } /** * Write your manual code between these tags. They will be retained if code is * regenerated. * IMPORTANT !!! Please do not remove these tags even if you dont add any manual code. */ //<manual-code> /** * The method which is called when the message is received * The onMessage method is deliberately put inside since * it will be manually changed and developers would like to retain it. */ public void onMessage(Message message){ if(message instanceof TextMessage){ TextMessage textMessage = (TextMessage)message; //Do Something with the message }else if(message instanceof BytesMessage){ BytesMessage bytesMessage = (BytesMessage)message; //Do Something with the message }else if(message instanceof MapMessage){ MapMessage mapMessage = (MapMessage)message; //Do Something with the message }else if(message instanceof ObjectMessage){ ObjectMessage objectMessage = (ObjectMessage)message; //Do Something with the message }else if(message instanceof StreamMessage){ StreamMessage streamMessage = (StreamMessage)message; //Do Something with the message } } //Write your custom methods here //</manual-code> /** * Invoked when the bean is destroyed */ public void ejbRemove(){ } public void setMessageDrivenContext(MessageDrivenContext _ejbContext){ ejbContext = _ejbContext; } void bar() throws MyException, MyOtherException{ } void foo(){ } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?