Reputation: 4562
Camel Route:
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
}
}
}
I need to call ProcessDefinition.unmarshal(dataformat)
. How can I get the ProcessDefinition
object inside process method?
Upvotes: 3
Views: 3709
Reputation: 838
You can directly call unmarshal of the dataformat with Exchange
and Exchange.getIn().getBody(InputStream.class)
as another param:
dataformat.unmarshal(exchange, exachange.getIn().getBody(InputStream.class));
You don't need to call the ProcessDefinition.unmarshal()
; ProcessDefinition
only defines which dataformat to use and finally when your message comes in what happens is the Dataformat.unmarshal()
method is called with Exchange
and Body InputStream
.
Upvotes: 3