Search code examples
spring-cloud-streamspring-cloud-config

headermode properties for Custom Processor, Sink and Producer


I am using the following Custom Processor for binding the Message channels.

package test;

import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;

public interface ProcessorInput {

    String INPUT_CHANNEL = "test1";
    String OUTPUT_CHANNEL = "test2";

    @Input(INPUT_CHANNEL)
    MessageChannel inputchannel();

    @Output(OUTPUT_CHANNEL)
    SubscribableChannel outputchannel();

}

I am trying to control header with the following properties but its not being effective.

spring.cloud.stream.bindings.output.producer.headerMode=raw
spring.cloud.stream.bindings.input.consumer.headerMode=raw

i also tried binding producer and consumer in the properties and still not effective.

spring.cloud.stream.bindings.output.consumer=test1
spring.cloud.stream.bindings.input.producer=test2
spring.cloud.stream.bindings.output.producer.headerMode=raw
spring.cloud.stream.bindings.input.consumer.headerMode=raw

Please suggest for any corrections.


Solution

  • The binder knows nothing about your custom channel names.

    You need to use the correct channel name in the property, e.g.

    spring.cloud.stream.bindings.test2.producer.headerMode=raw