QueueReader.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package bible.webservices.message.consumer;
- import javax.jms.*;
- import javax.naming.*;
- import javax.ejb.CreateException;
- import javax.ejb.MessageDrivenContext;
- import javax.ejb.MessageDrivenBean;
- import java.rmi.RemoteException;
- /**
- * Class QueueReader
- *
- *
- * @author
- * @version %I%, %G%
- */
- public class QueueReader implements MessageDrivenBean, MessageListener {
- private transient MessageDrivenContext mdc = null;
- private Context context;
- /**
- * Constructor QueueReader
- *
- *
- */
- public QueueReader() {}
- /**
- * Method setMessageDrivenContext
- *
- *
- * @param mdc
- *
- */
- public void setMessageDrivenContext(MessageDrivenContext mdc) {
- this.mdc = mdc;
- }
- /**
- * Method ejbCreate
- *
- *
- */
- public void ejbCreate() {}
- /**
- * Method ejbRemove
- *
- *
- */
- public void ejbRemove() {}
- /**
- * Method onMessage
- *
- *
- * @param message
- *
- */
- public void onMessage(Message message) {
- ObjectMessage tm = (ObjectMessage) message;
- try {
- System.out.println("The text in the message was " + tm.getObject());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- /*--- Formatted in Bible Style on Thu, Sep 6, '01 ---*/
- /*------ Formatted by Jindent 3.24 Gold 1.02 --- http://www.jindent.de ------*/