I am using Spring Cloud Stream, with RabbitMQ binder. It works great with byte[]
payload and Java native serialization, but I need to work with JSON payload.
Here's my processor class.
@EnableBinding(Processor.class)
public class MessageProcessor {
@ServiceActivator(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
public OutputDto handleIncomingMessage(InputDto inputDto) {
// Run some job.
return new OutputDto();
}
}
InputDto
and OutputDto
are POJOs with Jackson annotations.
- How do I configure JSON conversion strategy?
- How should message headers look like to be accepted and processed?