01: /*
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * Initial developer(s): ____________________________________.
22: * Contributor(s): ______________________________________.
23: *
24: * --------------------------------------------------------------------------
25: * $Id: MdbBean.java 8313 2006-05-02 12:40:35Z braeuney $
26: * --------------------------------------------------------------------------
27: */
28:
29: // MdbBean.java
30: // Message Driven bean
31: package newsamplemdb2;
32:
33: import javax.jms.Message;
34: import javax.jms.TextMessage;
35: import javax.jms.JMSException;
36:
37: /**
38: * Example of MessageDrivenBean on a Queue. The transactions are container managed (Required)
39: * this class have superclasses in which are defined ejbCreate() and onMessage()
40: * this strange structure is only for reproducing bug 300387
41: * for a more normal structure see the samplemdb sample
42: */
43: public class MdbBean extends MdbBean_b {
44:
45: /**
46: * Default constructor
47: *
48: */
49: public MdbBean() {
50: }
51:
52: /**
53: * onMessage1 method
54: */
55: public void onMessage1(Message message) {
56: System.out.println("MdbBean onMessage1");
57: try {
58: TextMessage mess = (TextMessage) message;
59: System.out.println("Message received: " + mess.getText());
60: } catch (JMSException ex) {
61: System.err.println("Exception caught: " + ex);
62: }
63: }
64: }
|