1 package net.walend.jmsbridge; 2 3 import javax.jms.MessageProducer ; 4 import javax.jms.MessageConsumer ; 5 import javax.jms.Session ; 6 import javax.jms.JMSException ; 7 import javax.jms.MessageListener ; 8 import javax.jms.ExceptionListener ; 9 import javax.jms.Message ; 10 import javax.jms.ObjectMessage ; 11 import javax.jms.QueueReceiver ; 12 import javax.jms.QueueSender ; 13 import javax.jms.QueueSession ; 14 15 16 21 22 public class QueueBridge 23 extends AbstractBridge 24 { 25 public QueueBridge(QueueReceiver source,QueueSender sink,QueueSession sinkSession,ExceptionListener exceptionListener) 26 throws JMSException 27 { 28 super(source,sink,sinkSession,exceptionListener); 29 } 30 31 protected MessageListener createBridgeListener(MessageProducer sink,Session sinkSession,ExceptionListener exceptionListener) 32 { 33 return new QueueBridgeListener((QueueSender )sink,(QueueSession )sinkSession,exceptionListener); 34 } 35 36 37 protected class QueueBridgeListener 38 extends BridgeListener 39 { 40 private QueueSender sender; 41 42 public QueueBridgeListener(QueueSender sink,QueueSession sinkSession,ExceptionListener exceptionListener) 43 { 44 super(sinkSession,exceptionListener); 45 this.sender = sink; 46 } 47 48 51 protected void send(Message message) 52 throws JMSException 53 { 54 sender.send(message); 55 } 56 } 57 58 59 } 60 61 81 | Popular Tags |