KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > interceptor > bean > EmailMDB


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.tutorial.interceptor.bean;
8
9 import javax.ejb.MessageDriven JavaDoc;
10 import javax.ejb.AroundInvoke;
11 import javax.ejb.InvocationContext;
12 import javax.ejb.ActivationConfigProperty JavaDoc;
13 import javax.jms.Message JavaDoc;
14 import javax.jms.MessageListener JavaDoc;
15
16 @MessageDriven JavaDoc(activateConfig =
17         {
18         @ActivationConfigProperty JavaDoc(propertyName="destinationType", propertyValue="javax.jms.Queue"),
19         @ActivationConfigProperty JavaDoc(propertyName="destination", propertyValue="queue/tutorial/example")
20         })
21 public class EmailMDB implements MessageListener JavaDoc
22 {
23    public void onMessage(Message JavaDoc recvMsg)
24    {
25       System.out.println("----------------");
26       System.out.println("Got message, sending email");
27       System.out.println("----------------");
28       //Generate and save email
29
}
30
31    @AroundInvoke
32    public Object JavaDoc mdbInterceptor(InvocationContext ctx) throws Exception JavaDoc
33    {
34       System.out.println("*** EmailMDB.mdbInterceptor intercepting");
35       return ctx.proceed();
36    }
37 }
38
Popular Tags