在AMQP入站适配器中过滤掉AMQP消息的标头

时间:2020-10-09 17:54:37

标签: spring-integration spring-integration-dsl spring-integration-amqp

鉴于我有edit

onDestroy

我想将HeaderFilter应用于AMQP入站适配器,但看来我只能在管道的后期才能这样做。

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

1 个答案:

答案 0 :(得分: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) {

有关更多详细信息,请参见DefaultAmqpHeaderMapper JavaDocs和相应的参考手册:https://docs.spring.io/spring-integration/docs/5.3.2.RELEASE/reference/html/amqp.html#amqp-message-headers

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