288.3. Salesforce ヘッダーを渡し、Salesforceレスポンスヘッダーを取得する

Camel 2.21 では、受信メッセージヘッダーを介して Salesforce ヘッダー を渡すことがサポートされています。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);
   }
}