1 18 package org.apache.activemq.ra; 19 20 import javax.jms.Destination ; 21 import javax.jms.JMSException ; 22 import javax.jms.Message ; 23 import javax.jms.MessageProducer ; 24 import javax.jms.Queue ; 25 import javax.jms.QueueSender ; 26 import javax.jms.Topic ; 27 import javax.jms.TopicPublisher ; 28 29 35 public class InboundMessageProducerProxy implements MessageProducer , QueueSender , TopicPublisher { 36 37 private MessageProducer messageProducer; 38 private Destination destination; 39 private int deliveryMode; 40 private boolean disableMessageID; 41 private boolean disableMessageTimestamp; 42 private int priority; 43 private long timeToLive; 44 45 public InboundMessageProducerProxy(MessageProducer messageProducer, Destination destination) throws JMSException { 46 this.messageProducer = messageProducer; 47 this.destination = destination; 48 49 this.deliveryMode = messageProducer.getDeliveryMode(); 50 this.disableMessageID = messageProducer.getDisableMessageID(); 51 this.disableMessageTimestamp = messageProducer.getDisableMessageTimestamp(); 52 this.priority = messageProducer.getPriority(); 53 this.timeToLive = messageProducer.getTimeToLive(); 54 } 55 56 public void close() throws JMSException { 57 messageProducer.setDeliveryMode(deliveryMode); 60 messageProducer.setDisableMessageID(disableMessageID); 61 messageProducer.setDisableMessageTimestamp(disableMessageTimestamp); 62 messageProducer.setPriority(priority); 63 messageProducer.setTimeToLive(timeToLive); 64 } 65 66 public Destination getDestination() throws JMSException { 67 return destination; 68 } 69 70 public int getDeliveryMode() throws JMSException { 71 return messageProducer.getDeliveryMode(); 72 } 73 74 public boolean getDisableMessageID() throws JMSException { 75 return messageProducer.getDisableMessageID(); 76 } 77 78 public boolean getDisableMessageTimestamp() throws JMSException { 79 return messageProducer.getDisableMessageTimestamp(); 80 } 81 82 public int getPriority() throws JMSException { 83 return messageProducer.getPriority(); 84 } 85 86 public long getTimeToLive() throws JMSException { 87 return messageProducer.getTimeToLive(); 88 } 89 90 public void send(Destination destination, Message message) throws JMSException { 91 if (destination == null) { 92 destination = this.destination; 93 } 94 messageProducer.send(destination, message); 95 } 96 97 public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { 98 if (destination == null) { 99 destination = this.destination; 100 } 101 messageProducer.send(destination, message, deliveryMode, priority, timeToLive); 102 } 103 104 public void send(Message message) throws JMSException { 105 messageProducer.send(destination, message); 106 } 107 108 public void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { 109 messageProducer.send(destination, message, deliveryMode, priority, timeToLive); 110 } 111 112 public void setDeliveryMode(int i) throws JMSException { 113 messageProducer.setDeliveryMode(i); 114 } 115 116 public void setDisableMessageID(boolean b) throws JMSException { 117 messageProducer.setDisableMessageID(b); 118 } 119 120 public void setDisableMessageTimestamp(boolean b) throws JMSException { 121 messageProducer.setDisableMessageTimestamp(b); 122 } 123 124 public void setPriority(int i) throws JMSException { 125 messageProducer.setPriority(i); 126 } 127 128 public void setTimeToLive(long l) throws JMSException { 129 messageProducer.setTimeToLive(l); 130 } 131 132 public Queue getQueue() throws JMSException { 133 return (Queue ) messageProducer.getDestination(); 134 } 135 136 public void send(Queue arg0, Message arg1) throws JMSException { 137 messageProducer.send(arg0, arg1); 138 } 139 140 public void send(Queue arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException { 141 messageProducer.send(arg0, arg1, arg2, arg3, arg4); 142 } 143 144 public Topic getTopic() throws JMSException { 145 return (Topic ) messageProducer.getDestination(); 146 } 147 148 public void publish(Message arg0) throws JMSException { 149 messageProducer.send(arg0); 150 } 151 152 public void publish(Message arg0, int arg1, int arg2, long arg3) throws JMSException { 153 messageProducer.send(arg0, arg1, arg2, arg3); 154 } 155 156 public void publish(Topic arg0, Message arg1) throws JMSException { 157 messageProducer.send(arg0, arg1); 158 } 159 160 public void publish(Topic arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException { 161 messageProducer.send(arg0, arg1, arg2, arg3, arg4); 162 } 163 } 164 | Popular Tags |