01: package dalma.endpoints.jbi;
02:
03: import javax.jbi.messaging.DeliveryChannel;
04: import javax.jbi.messaging.MessageExchange;
05: import javax.jbi.messaging.MessagingException;
06: import java.util.logging.Logger;
07: import java.util.logging.Level;
08:
09: /**
10: * @author Kohsuke Kawaguchi
11: */
12: final class ReceiverThread extends Thread {
13: private final JBIEndPoint endPoint;
14: private final DeliveryChannel channel;
15:
16: private static final Logger logger = Logger
17: .getLogger(ReceiverThread.class.getName());
18:
19: public ReceiverThread(JBIEndPoint endPoint, DeliveryChannel channel) {
20: this .endPoint = endPoint;
21: this .channel = channel;
22: }
23:
24: public void run() {
25: while (true) {
26: try {
27: MessageExchange me = channel.accept();
28: endPoint.onNewMessage(me);
29: } catch (MessagingException e) {
30: logger.log(Level.WARNING,
31: "Failed to accept a message via JBI", e);
32: }
33: }
34: }
35: }
|