268.3. Salesforce ヘッダーを渡して Salesforce 応答ヘッダーの取得
Camel 2.21 では、インバウンドメッセージ ヘッダーを介して Salesforce ヘッダーを渡すサポートがあり、Camel メッセージ上で Sforce または x-sfdc で始まるヘッダー名はリクエストで渡されます。また、Sforce で始まるレスポンスヘッダーは outboud メッセージヘッダーに存在します。
たとえば、以下を指定する 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);
}
}