1
|
package eu.dnetlib.enabling.is.sn;
|
2
|
|
3
|
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
4
|
|
5
|
import org.apache.commons.logging.Log;
|
6
|
import org.apache.commons.logging.LogFactory;
|
7
|
|
8
|
/**
|
9
|
* This implementation of NotificationSender simply sends notification synchronously.
|
10
|
*
|
11
|
* NOTE: this is only for testing. Real-wold cases should use AsynchrnonousNotificationSender, because we have to
|
12
|
* get out the thread serving eXist queries.
|
13
|
*
|
14
|
* @author marko
|
15
|
*
|
16
|
*/
|
17
|
public class SynchronousNotificationSenderImpl extends AbstractNotificationSender {
|
18
|
|
19
|
/**
|
20
|
* logger.
|
21
|
*/
|
22
|
private static final Log log = LogFactory.getLog(SynchronousNotificationSenderImpl.class); // NOPMD by marko on 11/24/08 5:02 PM
|
23
|
|
24
|
/**
|
25
|
* {@inheritDoc}
|
26
|
*
|
27
|
* @see eu.dnetlib.enabling.is.sn.NotificationSender#send(javax.xml.ws.wsaddressing.W3CEndpointReference,
|
28
|
* eu.dnetlib.enabling.is.sn.NotificationMessage)
|
29
|
*/
|
30
|
@Override
|
31
|
public void send(final W3CEndpointReference destination, final NotificationMessage message) {
|
32
|
log.info("synchronously sending message " + message.getSubscriptionId() + ", " + message.getTopic() + ", " + message.getResourceId() + ", "
|
33
|
+ message.getBody());
|
34
|
try {
|
35
|
getInvoker().send(destination, message, 0);
|
36
|
} catch (javax.xml.ws.soap.SOAPFaultException t) {
|
37
|
log.fatal("error sending notification to " + destination.toString(), t);
|
38
|
}
|
39
|
}
|
40
|
}
|