Search in sources :

Example 1 with OwnerApplicationListenerRouteBuilder

use of won.owner.camel.routes.OwnerApplicationListenerRouteBuilder 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);
    }
}
Also used : CamelConfigurationFailedException(won.protocol.exception.CamelConfigurationFailedException) OwnerApplicationListenerRouteBuilder(won.owner.camel.routes.OwnerApplicationListenerRouteBuilder) CamelConfigurationFailedException(won.protocol.exception.CamelConfigurationFailedException)

Example 2 with OwnerApplicationListenerRouteBuilder

use of won.owner.camel.routes.OwnerApplicationListenerRouteBuilder 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);
    }
}
Also used : CamelConfigurationFailedException(won.protocol.exception.CamelConfigurationFailedException) OwnerApplicationListenerRouteBuilder(won.owner.camel.routes.OwnerApplicationListenerRouteBuilder) CamelConfigurationFailedException(won.protocol.exception.CamelConfigurationFailedException)

Aggregations

OwnerApplicationListenerRouteBuilder (won.owner.camel.routes.OwnerApplicationListenerRouteBuilder)2 CamelConfigurationFailedException (won.protocol.exception.CamelConfigurationFailedException)2