1 22 package org.jboss.ejb3.test.jms; 23 24 import javax.annotation.Resource; 25 import javax.ejb.Remote ; 26 import javax.ejb.Stateless ; 27 import org.jboss.annotation.ejb.RemoteBinding; 28 import org.jboss.logging.Logger; 29 30 34 @Stateless 35 @Remote (QueueStateless.class) 36 @RemoteBinding(jndiBinding = "QueueStateless") 37 public class QueueStatelessBean implements QueueStateless 38 { 39 private static final Logger log = Logger.getLogger(QueueStatelessBean.class); 40 41 @Resource(mappedName="java:/ConnectionFactory") javax.jms.QueueConnectionFactory queueFactory; 42 @Resource(mappedName="queue/testQueue") javax.jms.Queue testQueue; 43 44 public void send(String text) throws Exception 45 { 46 javax.jms.QueueConnection queueConnection; 47 javax.jms.QueueSession queueSession; 48 javax.jms.QueueSender queueSender; 49 javax.jms.TextMessage message; 50 51 queueConnection = queueFactory.createQueueConnection(); 52 queueSession = queueConnection.createQueueSession(true,0); 53 queueSender = queueSession.createSender(testQueue); 54 message = queueSession.createTextMessage(text); 55 } 56 } 57 58 | Popular Tags |