如何在骆驼配置中定义公共路由体?
How to define common route body in camel configuration?
我有两个route
骆驼配置
路线 1
<route>
<from uri="cxf:bean:soapProxy1?dataFormat=PAYLOAD" />
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Contents-type">
<constant>application/octet-stream</constant>
</setHeader>
<setHeader headerName="SOAPAction">
<constant>vc</constant>
</setHeader>
<setHeader headerName="Accept">
<constant>application/xml</constant>
</setHeader>
<to uri="bean:samlWsBean" />
<choice>
<when>
<simple>${in.header.isvalid} contains "true"</simple>
<to uri="cxf:bean:backendService?dataFormat=PAYLOAD"/>
</when>
<otherwise>
<to uri="velocity:file:///path/samlerrorresponse.vm"/>
</otherwise>
</choice>
</route>
路线2
<route>
<from uri="cxf:bean:soapProxy2?dataFormat=PAYLOAD" />
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Contents-type">
<constant>application/octet-stream</constant>
</setHeader>
<setHeader headerName="SOAPAction">
<constant>vc</constant>
</setHeader>
<setHeader headerName="Accept">
<constant>application/xml</constant>
</setHeader>
<to uri="bean:samlWsBean" />
<choice>
<when>
<simple>${in.header.isvalid} contains "true"</simple>
<to uri="cxf:bean:backendService?dataFormat=PAYLOAD"/>
</when>
<otherwise>
<to uri="velocity:file:///path/samlerrorresponse.vm"/>
</otherwise>
</choice>
</route>
两条线路仅相差一处。
一个有这个
<from uri="cxf:bean:soapProxy1?dataFormat=PAYLOAD" />
另一个有这个
<from uri="cxf:bean:soapProxy2?dataFormat=PAYLOAD" />
所以我可以将公共主体放在配置的其他地方并在两条路线中引用吗?
我有两个route
骆驼配置
路线 1
<route>
<from uri="cxf:bean:soapProxy1?dataFormat=PAYLOAD" />
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Contents-type">
<constant>application/octet-stream</constant>
</setHeader>
<setHeader headerName="SOAPAction">
<constant>vc</constant>
</setHeader>
<setHeader headerName="Accept">
<constant>application/xml</constant>
</setHeader>
<to uri="bean:samlWsBean" />
<choice>
<when>
<simple>${in.header.isvalid} contains "true"</simple>
<to uri="cxf:bean:backendService?dataFormat=PAYLOAD"/>
</when>
<otherwise>
<to uri="velocity:file:///path/samlerrorresponse.vm"/>
</otherwise>
</choice>
</route>
路线2
<route>
<from uri="cxf:bean:soapProxy2?dataFormat=PAYLOAD" />
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Contents-type">
<constant>application/octet-stream</constant>
</setHeader>
<setHeader headerName="SOAPAction">
<constant>vc</constant>
</setHeader>
<setHeader headerName="Accept">
<constant>application/xml</constant>
</setHeader>
<to uri="bean:samlWsBean" />
<choice>
<when>
<simple>${in.header.isvalid} contains "true"</simple>
<to uri="cxf:bean:backendService?dataFormat=PAYLOAD"/>
</when>
<otherwise>
<to uri="velocity:file:///path/samlerrorresponse.vm"/>
</otherwise>
</choice>
</route>
两条线路仅相差一处。
一个有这个
<from uri="cxf:bean:soapProxy1?dataFormat=PAYLOAD" />
另一个有这个
<from uri="cxf:bean:soapProxy2?dataFormat=PAYLOAD" />
所以我可以将公共主体放在配置的其他地方并在两条路线中引用吗?