use of won.protocol.exception.CamelConfigurationFailedException in project webofneeds by researchstudio-sat.
the class OwnerProtocolCamelConfiguratorImpl method addRemoteQueueListeners.
@Override
public synchronized void addRemoteQueueListeners(List<String> endpoints, URI remoteEndpoint) throws CamelConfigurationFailedException {
List<String> customSchemeEndpoints = adjustSchemeToRemoteEndpoint(endpoints, remoteEndpoint);
// remove endpoints already configured in the camel context
customSchemeEndpoints = customSchemeEndpoints.stream().filter(x -> camelContext.hasEndpoint(x) == null).collect(Collectors.toList());
if (customSchemeEndpoints.size() > 0) {
logger.debug("Adding route for listening to remote queue {} ", remoteEndpoint);
OwnerApplicationListenerRouteBuilder ownerApplicationListenerRouteBuilder = new OwnerApplicationListenerRouteBuilder(camelContext, customSchemeEndpoints, remoteEndpoint);
try {
camelContext.addRoutes(ownerApplicationListenerRouteBuilder);
} catch (Exception e) {
logger.debug("adding route to camel context failed", e);
throw new CamelConfigurationFailedException("adding route to camel context failed", e);
}
} else {
logger.debug("route for listening to remote queue {} already configured", remoteEndpoint);
}
}
use of won.protocol.exception.CamelConfigurationFailedException in project webofneeds by researchstudio-sat.
the class MatcherProtocolCommunicationServiceImpl method addRemoteTopicListeners.
@Override
public synchronized void addRemoteTopicListeners(final Set<String> endpoints, final URI wonNodeUri) throws CamelConfigurationFailedException {
try {
registrationClient.register(wonNodeUri.toString());
URI remoteEndpoint = activeMQService.getBrokerEndpoint(wonNodeUri);
String remoteComponentName = matcherProtocolCamelConfigurator.setupBrokerComponentName(remoteEndpoint);
logger.debug("remoteComponentName: {}", remoteComponentName);
matcherProtocolCamelConfigurator.addCamelComponentForWonNodeBrokerForTopics(remoteEndpoint, remoteComponentName);
matcherProtocolCamelConfigurator.addRemoteTopicListeners(endpoints, remoteEndpoint);
} catch (CamelConfigurationFailedException ex) {
throw ex;
} catch (Exception e) {
logger.error("Error of security configuration for communication with " + wonNodeUri.toString());
throw new CamelConfigurationFailedException(e);
}
}
use of won.protocol.exception.CamelConfigurationFailedException in project webofneeds by researchstudio-sat.
the class OwnerProtocolCamelConfiguratorImpl method addRouteForEndpoint.
@Override
public synchronized void addRouteForEndpoint(String startingEndpoint, final URI wonNodeURI) throws CamelConfigurationFailedException {
/**
* there can be only one route per endpoint. Thus, consuming endpoint of each route shall be unique.
*/
// todo: using replaceAll might result in security issues. change this.
String tempStartingComponentName = startingComponent;
tempStartingComponentName = tempStartingComponentName + endpointMap.get(wonNodeURI).replaceAll(":", "_");
setStartingEndpoint(wonNodeURI, tempStartingComponentName);
if (camelContext.getComponent(tempStartingComponentName) == null || camelContext.getRoute(endpointMap.get(wonNodeURI)) == null) {
// OwnerProtocolDynamicRoutes ownerProtocolRouteBuilder = new OwnerProtocolDynamicRoutes(camelContext, tempStartingComponentName);
RoutesBuilder ownerProtocolRouteBuilder = createRoutesBuilder(tempStartingComponentName, wonNodeURI);
try {
camelContext.addRoutes(ownerProtocolRouteBuilder);
} catch (Exception e) {
throw new CamelConfigurationFailedException("adding route to camel context failed", e);
}
}
}
use of won.protocol.exception.CamelConfigurationFailedException in project webofneeds by researchstudio-sat.
the class OwnerProtocolCamelConfiguratorImpl method addRouteForWoNNode.
public synchronized void addRouteForWoNNode(final URI wonNodeURI) throws CamelConfigurationFailedException {
/**
* there can be only one route per endpoint. Thus, consuming endpoint of each
* route shall be unique.
*/
// todo: using replaceAll might result in security issues. change this.
String tempStartingComponentName = startingComponent;
tempStartingComponentName = tempStartingComponentName + endpointMap.get(wonNodeURI).replaceAll(":", "_");
setStartingEndpoint(wonNodeURI, tempStartingComponentName);
if (camelContext.getComponent(tempStartingComponentName) == null || camelContext.getRoute(endpointMap.get(wonNodeURI)) == null) {
// OwnerProtocolDynamicRoutes ownerProtocolRouteBuilder = new
// OwnerProtocolDynamicRoutes(camelContext, tempStartingComponentName);
RoutesBuilder ownerProtocolRouteBuilder = createRoutesBuilder(tempStartingComponentName, wonNodeURI);
try {
camelContext.addRoutes(ownerProtocolRouteBuilder);
} catch (Exception e) {
throw new CamelConfigurationFailedException("adding route to camel context failed", e);
}
}
}
use of won.protocol.exception.CamelConfigurationFailedException in project webofneeds by researchstudio-sat.
the class OwnerProtocolCamelConfiguratorImpl method addRemoteQueueListener.
@Override
public synchronized void addRemoteQueueListener(String endpoint, URI remoteEndpoint) throws CamelConfigurationFailedException {
// sending and receiving endpoint need to have the same scheme,
// look at WonJmsConfiguration and BrokerComponentFactory for JMS config info!
endpoint = remoteEndpoint.getScheme() + endpoint;
if (camelContext.hasEndpoint(endpoint) != null) {
logger.debug("route for listening to remote queue {} already configured", remoteEndpoint);
return;
}
logger.debug("Adding route for listening to remote queue {} ", endpoint);
OwnerApplicationListenerRouteBuilder ownerApplicationListenerRouteBuilder = new OwnerApplicationListenerRouteBuilder(camelContext, endpoint, remoteEndpoint);
try {
camelContext.addRoutes(ownerApplicationListenerRouteBuilder);
} catch (Exception e) {
logger.debug("adding route to camel context failed", e);
throw new CamelConfigurationFailedException("adding route to camel context failed", e);
}
}
Aggregations