01: package com.mockrunner.example.jms;
02:
03: import javax.ejb.EJBException;
04: import javax.ejb.MessageDrivenBean;
05: import javax.ejb.MessageDrivenContext;
06: import javax.jms.Message;
07: import javax.jms.MessageListener;
08: import javax.jms.TextMessage;
09:
10: /*
11: * @ejb:bean name="test/TestMessage"
12: * transaction-type="Container"
13: * acknowledge-mode="Auto-acknowledge"
14: * destination-type="javax.jms.Queue"
15: * subscription-durability="NonDurable"
16: *
17: * @ejb:transaction type="Required"
18: * @jboss:destination-jndi-name name="queue/testQueue"
19: */
20: /**
21: * Receiver for {@link PrintSessionBean}.
22: */
23: public class PrintMessageDrivenBean implements MessageDrivenBean,
24: MessageListener {
25: private MessageDrivenContext context;
26:
27: public void onMessage(Message message) {
28: if (message instanceof TextMessage) {
29: //do print
30: }
31: }
32:
33: public void setMessageDrivenContext(MessageDrivenContext context)
34: throws EJBException {
35: this .context = context;
36: }
37:
38: public void ejbCreate() {
39:
40: }
41:
42: public void ejbRemove() {
43:
44: }
45: }
|