2016-11-14 3 views
1

キャメルルート:ラクダのプロセッサでunmarshal()を呼び出す方法は?

from(source)   
    .idempotentConsumer(simple("${in.header.CamelFilePath}"), redisIdempotentRepository) 
    .process(pgpDecryptionProcessor) 
    .to(destination); 

PGPDecryptionProcessor:

public class PGPDecryptionProcessor implements Processor { 

    @Autowired 
    private PGPEncryptionManager pgpEncryptionManager; 

    @Override 
    public void process(Exchange exchange) throws Exception { 
    //do something to check whether it is encrypted 
    //get corrsponding dataformat for decryption 
    processDefinition.unmarshal(dataFormat); //How do i get processDefinition here 
    } 
    } 
} 

私はProcessDefinition.unmarshal(dataformat)を呼び出す必要があります。プロセスメソッド内でProcessDefinitionオブジェクトを取得するにはどうすればよいですか?

答えて

2

あなたは直接、別のparamとしてExchangeExchange.getIn().getBody(InputStream.class)とデータフォーマットのアンマーシャリングを呼び出すことができます。

dataformat.unmarshal(exchange, exachange.getIn().getBody(InputStream.class)); 

あなたはProcessDefinition.unmarshal()を呼び出す必要はありません。 ProcessDefinitionは、使用するデータフォーマットのみを定義し、最終的に何が起こるかはメソッドがExchangeBody InputStreamで呼び出されます。

関連する問題