0

鉴于我有IntegrationFlow

IntegrationFlows.from(
    Amqp.inboundAdapter(rabbitConnectionFactory, NTF_INCOMING_CMSF_EVENT_QUEUE)
            .messageConverter(new Jackson2JsonMessageConverter(jacksonObjectMapper))
)
    .get()

我想将HeaderFilter应用于 AMQP 入站适配器,但似乎我只能在管道的稍后部分执行此操作。

是否可以过滤入站适配器中的标头?

4

1 回答 1

1

这是可能的,但这已经被称为HeaderMapper.

请参阅以下选项Amqp.inboundAdapter()

/**
 * Configure the adapter's {@link AmqpHeaderMapper};
 * defaults to {@link DefaultAmqpHeaderMapper}.
 * @param headerMapper the headerMapper.
 * @return the spec.
 */
public S headerMapper(AmqpHeaderMapper headerMapper) {
    this.target.setHeaderMapper(headerMapper);
    return _this();
}

/**
 * Only applies if the default header mapper is used.
 * @param headers the headers.
 * @return the spec.
 * @see DefaultAmqpHeaderMapper#setRequestHeaderNames(String[])
 */
public S mappedRequestHeaders(String... headers) {

有关详细信息,请参阅DefaultAmqpHeaderMapperJavaDocs 和各自的参考手册:https ://docs.spring.io/spring-integration/docs/5.3.2.RELEASE/reference/html/amqp.html#amqp-message-headers

因此,您可能需要的是!标题名称模式上的否定运算符 ( )。

于 2020-10-09T19:36:25.777 回答