use of org.opennms.core.rpc.api.RpcModule in project opennms by OpenNMS.
the class CamelRpcServerRouteManager method bind.
@SuppressWarnings({ "rawtypes", "unchecked" })
public void bind(RpcModule module) throws Exception {
if (module != null) {
final RpcModule<RpcRequest, RpcResponse> rpcModule = (RpcModule<RpcRequest, RpcResponse>) module;
final String routeId = getRouteId(rpcModule);
final Route existingRoute = context.getRoute(routeId);
if (routeIdsByModule.containsKey(rpcModule)) {
if (existingRoute == null) {
LOG.error("RpcModule {} ({}) was marked as registered but its route {} cannot be found in the Camel context", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId);
} else {
LOG.warn("RpcModule {} ({}) was already registered on route {}: {}", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId, existingRoute);
}
} else {
if (existingRoute == null) {
final RouteBuilder routeBuilder = getRouteBuilder(context, identity, module);
context.addRoutes(routeBuilder);
routeIdsByModule.put(rpcModule, routeId);
LOG.info("Registered RpcModule {} ({}) on route {} with builder {}", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId, routeBuilder);
} else {
LOG.warn("RpcModule {} ({}) cannot be registered, route {} is already present: {}", rpcModule.getId(), Integer.toHexString(rpcModule.hashCode()), routeId, existingRoute);
}
}
}
}
Aggregations