use of won.bot.framework.eventbot.event.impl.matcher.MatcherRegisterFailedEvent in project webofneeds by researchstudio-sat.
the class RegisterMatcherAction method doRun.
@Override
protected void doRun(Event event, EventListener executingListener) throws Exception {
final Iterator wonNodeUriIterator = getEventListenerContext().getMatcherNodeURISource().getNodeURIIterator();
while (wonNodeUriIterator.hasNext()) {
URI wonNodeUri = (URI) wonNodeUriIterator.next();
try {
if (!registeredNodes.contains(wonNodeUri)) {
logger.debug("registering matcher on won node {}", wonNodeUri);
EventBotActionUtils.rememberInNodeListIfNamePresent(getEventListenerContext(), wonNodeUri);
getEventListenerContext().getMatcherProtocolMatcherService().register(wonNodeUri);
registeredNodes.add(wonNodeUri);
logger.info("matcher registered on won node {}", wonNodeUri);
}
} catch (Exception e) {
logger.warn("Error registering matcher at won node {}. Try again later ... Exception was {}", wonNodeUri, e);
getEventListenerContext().getEventBus().publish(new MatcherRegisterFailedEvent(wonNodeUri));
}
}
}
Aggregations