Skip to content

Commit

Permalink
Rebase Main support on Camel 2.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed Apr 11, 2016
1 parent 2a8c47c commit f1ca1b3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion impl/src/main/java/org/apache/camel/cdi/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@

import javax.enterprise.inject.UnsatisfiedResolutionException;
import javax.enterprise.inject.Vetoed;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand All @@ -50,7 +52,6 @@ public class Main extends MainSupport {
public static void main(String... args) throws Exception {
Main main = new Main();
instance = main;
main.enableHangupSupport();
main.run(args);
}

Expand Down Expand Up @@ -87,6 +88,17 @@ protected void doStart() throws Exception {
cdiContainer = container;
super.doStart();
postProcessContext();
warnIfNoCamelFound();
}

private void warnIfNoCamelFound() {
BeanManager manager = cdiContainer.getBeanManager();
Set<Bean<?>> contexts = manager.getBeans(CamelContext.class);
// Warn if the default CDI Camel context has no routes
if (contexts.size() == 1 && BeanManagerHelper.getReference(manager, CamelContext.class, contexts.iterator().next()).getRoutes().isEmpty()) {
LOG.warn("Camel CDI main has started with no Camel routes! "
+ "You may add some RouteBuilder beans to your project.");
}
}

@Override
Expand Down

0 comments on commit f1ca1b3

Please sign in to comment.