Hi,

I'm trying to create a dynamically constructed pipe using endpoints loaded
from a database at runtime. 'ToD' is being used with a header to set the
endpoint.

Camel version used is '3.0.0-M4', although I'm having a similar issue with
2.13.1

The XMLDSL for the main loop is as follows :
<route id="dynamicPipe">
 <!-- Iterate through filters -->
 <from uri="direct:dynamicPipe"/>
<!-- Populate header 'myFilter' with the endpoint uri -->
 <bean ref="pipeManager" method="popFilter"/>
 <when>
 <simple>${header.myFilter}</simple>
 <toD uri="${header.myFilter}"/>
 <to uri="direct:dynamicPipe"/>
 </when>
</route>

This works well for simple bean calls or logging, for example :

log:com.test.log?level=DEBUG
bean:jsonTools?method=convertXMLtoJSON

However when attempting to use the XSLTComponent with the bean scheme for
XSLT lookup, I'm getting an error.

The endpoint string is :
xslt:bean:entityCache.getXslt(${header.callerId},'myXSLT')?contentCache=false
or
<toD
uri="xslt:bean:entityCache.getXslt(${header.callerId},'myXSLT')?contentCache=false"/>

The stack trace is :


01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG DefaultComponentResolver:67
- Found component: xslt via type:
org.apache.camel.component.xslt.XsltComponent via:
META-INF/services/org/apache/camel/component/xslt
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG DefaultManagementAgent:478 -
Registered MBean with ObjectName:
org.apache.camel:context=camel,type=components,name="xslt"
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG XsltComponent:344 -
Resolving property placeholders on component:
org.apache.camel.component.xslt.XsltComponent@49056fd7
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG XsltComponent:197 - Creating
endpoint
uri=[xslt://bean:entityCache.getXslt($%7Bheader.callerId%7D,'test.xslt')?contentCache=false],
path=[bean:entityCache.getXslt(${header.callerId},'test.xslt')]
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG XsltComponent:189 -
org.apache.camel.component.xslt.XsltComponent@49056fd7 using schema
resource: bean:entityCache.getXslt(${header.callerId},'test.xslt')
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG SpringCamelContext:729 -
xslt://bean:entityCache.getXslt($%7Bheader.callerId%7D,'test.xslt')?contentCache=false
converted to endpoint:
xslt://bean:entityCache.getXslt($%7Bheader.callerId%7D,'test.xslt')?contentCache=false
by component: org.apache.camel.component.xslt.XsltComponent@49056fd7
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG XsltEndpoint:405 -
xslt://bean:entityCache.getXslt($%7Bheader.callerId%7D,'test.xslt')?contentCache=false
using schema resource:
bean:entityCache.getXslt(${header.callerId},'test.xslt')
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG XsltUriResolver:88 -
Resolving URI from classpath::
classpath:bean:entityCache.getXslt(${header.callerId},'test.xslt')
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG DefaultReactiveExecutor:196
- Queuing reactive work:
Step[ID-DESKTOP-597PGE0-1569944137722-0-1,DefaultErrorHandler[sendTo(header(callerFilter))]]
01-10-19 16:35:38 [http-nio-8081-exec-1] DEBUG DefaultErrorHandler:152 -
Failed delivery for (MessageId: ID-DESKTOP-597PGE0-1569944137722-0-2 on
ExchangeId: ID-DESKTOP-597PGE0-1569944137722-0-1). On delivery attempt: 0
caught: org.apache.camel.ResolveEndpointFailedException: Failed to resolve
endpoint:
xslt://bean:entityCache.getXslt($%7Bheader.callerId%7D,'test.xslt')?contentCache=false
due to: javax.xml.transform.TransformerException:
java.io.FileNotFoundException: Cannot find resource:
classpath:bean:entityCache.getXslt(${header.callerId},'test.xslt') in
classpath for URI:
classpath:bean:entityCache.getXslt(${header.callerId},'test.xslt')


Any ideas? I've attempted to write a custom URIResolver instead but Im
having trouble passing all the information I'd like to (callerId,
artefactId) so it can lookup the required entity from a database.

Many Thanks,
James.

Reply via email to