Skip to content

Commit

Permalink
Provide default value for XML route in Kura Camel quickstart #131
Browse files Browse the repository at this point in the history
  • Loading branch information
hekonsek committed May 13, 2016
1 parent 32a50df commit 634218f
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,14 @@ protected void updated(Map<String, Object> properties) {

public void refreshCamelRouteXml(String oldCamelRouteXml, String newCamelRouteXml) {
if (newCamelRouteXml != null && !newCamelRouteXml.isEmpty() &&
newCamelRouteXml.contains("<route ") &&
!newCamelRouteXml.equals(oldCamelRouteXml)) {
this.m_camelRouteXml = newCamelRouteXml;
if (!m_camelRouteXml.isEmpty()) {
try {
ByteArrayInputStream bais = new ByteArrayInputStream(m_camelRouteXml.getBytes());
RoutesDefinition routesDefinition = camelContext.loadRoutesDefinition(bais);
camelContext.addRouteDefinitions(routesDefinition.getRoutes());
} catch (Exception e) {
s_logger.warn("Cannot load routes definitions: {}", m_camelRouteXml, e);
}
try {
ByteArrayInputStream bais = new ByteArrayInputStream(m_camelRouteXml.getBytes());
RoutesDefinition routesDefinition = camelContext.loadRoutesDefinition(bais);
camelContext.addRouteDefinitions(routesDefinition.getRoutes());
} catch (Exception e) {
s_logger.warn("Cannot load routes definitions: {}", m_camelRouteXml, e);
}
}
}
Expand Down

0 comments on commit 634218f

Please sign in to comment.