288.3. 在 Salesforce 标头中传递并获取 Salesforce 响应标头
在 Camel 2.21 中支持通过入站 邮件标题传递 Salesforce 标头、以 Sforce 或 x-sfdc 开头的标题名称,将在请求中传递 Camel 消息上的 Sforce 或 x-sfdc,并响应以 Sforce 开头的响应标头。
例如,若要获取 API 限制,您可以指定:
// in your Camel route set the header before Salesforce endpoint
//...
.setHeader("Sforce-Limit-Info", constant("api-usage"))
.to("salesforce:getGlobalObjects")
.to(myProcessor);
// myProcessor will receive `Sforce-Limit-Info` header on the outbound
// message
class MyProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
String apiLimits = in.getHeader("Sforce-Limit-Info", String.class);
}
}