Apache camel 使用Camel recipientList获得ClassCastException
我试图使用ApacheCamel在程序运行时动态指定目标。将recipientList参数更改为端点列表后,将遇到ClassCastException 如果我错过了什么,谁能帮我提建议 非常感谢Apache camel 使用Camel recipientList获得ClassCastException,apache-camel,cxf,Apache Camel,Cxf,我试图使用ApacheCamel在程序运行时动态指定目标。将recipientList参数更改为端点列表后,将遇到ClassCastException 如果我错过了什么,谁能帮我提建议 非常感谢 from("jms:queue:jms/XXXQ").recipientList(header("recipientList")); List<Endpoint> eps = new ArrayList<Endpoint>(); CxfEndpoint endpoint =
from("jms:queue:jms/XXXQ").recipientList(header("recipientList"));
List<Endpoint> eps = new ArrayList<Endpoint>();
CxfEndpoint endpoint = exchange.getContext().getEndpoint("cxf:bean:configServiceEndpoint", CxfEndpoint.class);
endpoint.setAddress(URL);
endpoint.setWsdlURL(WSDL);
eps.add(endpoint);
CxfProducer cp = (CxfProducer) endpoint.createProducer();
cp.start();
exchange.getIn().setHeader("recipientList", eps);
<cxf:cxfEndpoint id="configServiceEndpoint" address="${CXFTestSupport.URL}" wsdlURL="${CXFTestSupport.WSDL}" serviceClass="com.company.client.ClientService">
</cxf:cxfEndpoint>
你把
List<Endpoint>
列表
到recipientList标头,但根据文档(,“动态收件人列表”->“可迭代值”)不能使用端点对象:
标题中定义的收件人动态列表必须为
例如:
- java.util.Collection
- java.util.Iterator
- 阵列
- org.w3c.dom.NodeList
- 值用逗号分隔的单个字符串
- 任何其他类型将被视为单一值
是正确的,因此将
cxf:bean:configServiceEndpoint
作为字符串值放在该标题中。如果解决了该问题,请将其标记为问题的答案:)
List<Endpoint>