SessionPoolConsumer.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- package bible.jms;
- import javax.jms.*;
- /**
- * Class SessionPoolConsumer
- *
- *
- * @author
- * @version %I%, %G%
- */
- public class SessionPoolConsumer implements MessageListener {
- /**
- * Method onMessage
- *
- *
- * @param message
- *
- */
- public void onMessage(Message message) {
- if (message instanceof BytesMessage) {
- BytesMessage bytesMessage = (BytesMessage) message;
- // Process bytesMessage here
- } else {
- if (message instanceof MapMessage) {
- MapMessage mapMessage = (MapMessage) message;
- // Process mapMessage here
- } else {
- if (message instanceof ObjectMessage) {
- ObjectMessage objectMessage = (ObjectMessage) message;
- // Process objectMessage here
- } else {
- if (message instanceof StreamMessage) {
- StreamMessage streamMessage = (StreamMessage) message;
- // Process streamMessage here
- } else {
- if (message instanceof TextMessage) {
- try {
- TextMessage textMessage = (TextMessage) message;
- // Process textMessage here
- String msg = textMessage.getText();
- System.out.println("Received message: " + msg);
- } 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 ------*/