Search code examples
spring-integration

Spring Integration nullChannel reference in Non-DSL


We have a dynamic IntegratonFlow registration using IntegrationFlowContext. For an conditional use-case we need to set the replyChannel with reference to Spring Integration Context's nullChannel object. How do I get the MessageChannel reference of framework created nullChannel object?

Will MessageChannels.direct(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME).getObject() provide me the framework created nullChannel ?

Thanks


Solution

  • No, it does not. The default nullChannel is an instance of NullChannel. I'm not sure why you need to deal with MessageChannels factory, but there is just enough to have that nullChannel to be auto-wired into the service you are going to use it. Or just rely on a nullChannel string as is and the framework will be able to resolve it properly.

    Otherwise, please, share more info about your configuration, and we will look what more specific solution would fit into your requirements.