private void registerSubscribers(EventBroker eventBroker, String topic,
List<String> endpointUrls) throws DataServiceFault {
if (eventBroker == null) {
String msg = "Unable To Register Event Subscribers, Event Broker Not Available.";
log.error(msg);
throw new DataServiceFault(msg);
}
/*
* Adding new subscriptions.
*/
Subscription subscription;
for (String epr : endpointUrls) {
try {
subscription = new Subscription();
subscription.setEventSinkURL(epr);
subscription.setId(UUID.randomUUID().toString());
subscription.setTopicName(topic);
subscription.setEventDispatcherName(EVENT_DISPATCHER_NAME);
subscription.setOwner(this.getDataService().getName());
eventBroker.subscribe(subscription);
} catch (Exception e) {
throw new DataServiceFault(e, "Error in event subscription for EPR: " + epr +
" Topic:" + topic);
}
}
}