use of org.apache.camel.CamelContext in project camel by apache.
the class CamelCommandsFacade method getCamelContextForRoute.
private String getCamelContextForRoute(String routeId) throws Exception {
ArrayList<String> contextNames = new ArrayList<String>();
for (CamelContext camelContext : camelController.getLocalCamelContexts()) {
for (Route route : camelContext.getRoutes()) {
if (routeId.equals(route.getId())) {
contextNames.add(camelContext.getName());
break;
}
}
}
if (contextNames.size() != 1) {
StringBuffer error = new StringBuffer();
error.append("Cannot infer CamelContext. Please provide manually.");
if (contextNames.size() > 1) {
error.append(" Contexts : " + contextNames.toString());
}
throw new org.crsh.cli.impl.SyntaxException(error.toString());
}
return contextNames.get(0);
}
use of org.apache.camel.CamelContext in project camel by apache.
the class CamelControllerImpl method getCamelContexts.
public List<Map<String, String>> getCamelContexts() throws Exception {
List<Map<String, String>> answer = new ArrayList<Map<String, String>>();
List<CamelContext> camelContexts = getLocalCamelContexts();
for (CamelContext camelContext : camelContexts) {
Map<String, String> row = new LinkedHashMap<String, String>();
row.put("name", camelContext.getName());
row.put("state", camelContext.getStatus().name());
row.put("uptime", camelContext.getUptime());
if (camelContext.getManagedCamelContext() != null) {
row.put("exchangesTotal", "" + camelContext.getManagedCamelContext().getExchangesTotal());
row.put("exchangesInflight", "" + camelContext.getManagedCamelContext().getExchangesInflight());
row.put("exchangesFailed", "" + camelContext.getManagedCamelContext().getExchangesFailed());
} else {
row.put("exchangesTotal", "0");
row.put("exchangesInflight", "0");
row.put("exchangesFailed", "0");
}
answer.add(row);
}
return answer;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class BaseNettyTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
context.addComponent("properties", new PropertiesComponent("ref:prop"));
return context;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class NagiosEventNotifierTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
NagiosEventNotifier notifier = new NagiosEventNotifier(nagiosPassiveCheckSender);
notifier.getConfiguration().setHost("localhost");
notifier.getConfiguration().setPort(25669);
notifier.getConfiguration().setPassword("password");
CamelContext context = super.createCamelContext();
context.getManagementStrategy().addEventNotifier(notifier);
return context;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class BaseNettyTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
context.addComponent("properties", new PropertiesComponent("ref:prop"));
return context;
}
Aggregations