Skip to content

Commit

Permalink
SWITCHYARD-2351 Namespace context not set for camel bindings with unm…
Browse files Browse the repository at this point in the history
…anaged threads
  • Loading branch information
Keith Babo committed Sep 25, 2014
1 parent 020fdae commit 523b39a
Showing 1 changed file with 18 additions and 1 deletion.
Expand Up @@ -45,6 +45,8 @@
*/
public class InboundHandler<T extends CamelBindingModel> extends BaseServiceHandler {

private static final String NAMESPACE_POLICY_REF = "org.switchyard.namespaceContextPolicy";

private final T _camelBindingModel;
private final SwitchYardCamelContext _camelContext;
private final QName _serviceName;
Expand Down Expand Up @@ -83,7 +85,11 @@ protected RouteDefinition createRouteDefinition() {
.setProperty(CamelConstants.APPLICATION_NAMESPACE).constant(_serviceName.getNamespaceURI())
.process(new MessageComposerProcessor(getBindingModel()))
.process(new OperationSelectorProcessor(getServiceName(), getBindingModel()));
return addTransactionPolicy(route);

addNamespacePolicy(route);
addTransactionPolicy(route);

return route;
}

/**
Expand Down Expand Up @@ -122,6 +128,17 @@ protected RouteDefinition addTransactionPolicy(final RouteDefinition route) {
return route;
}

/**
* Only add a namespace policy if the policy ref can be resolved, which will
* be the case on EAP but not on Karaf.
*/
protected RouteDefinition addNamespacePolicy(final RouteDefinition route) {
if (_camelContext.getRegistry().lookup(NAMESPACE_POLICY_REF) != null) {
route.routePolicyRef(NAMESPACE_POLICY_REF);
}
return route;
}

protected URI getComponentUri() {
return getBindingModel().getComponentURI();
}
Expand Down

0 comments on commit 523b39a

Please sign in to comment.