Skip to content

Simple filtering of a message results in a warning being logged #8746

Closed as not planned
@abiri-1mrobotics

Description

@abiri-1mrobotics

We've recently upgraded from Spring Boot 2.7.x to 3.1.x. Our existing Spring Integration flows suddenly start spamming the logs with:

xxxx-xx-xxTxx:xx:xx.xxx+xx:xx  WARN xxxxx --- [       Thread-x] o.s.integration.filter.MessageFilter     : The message [GenericMessage [...] has been rejected in filter: bean '...' for component '...'

Which is easily traced back to this snippet of code:

@Override
public Object postProcess(Message<?> message, Object result) {
if (result == null) {
MessageChannel channelToDiscard = getDiscardChannel();
if (channelToDiscard != null) {
this.messagingTemplate.send(channelToDiscard, message);
}
if (this.throwExceptionOnRejection) {
throw new MessageRejectedException(message, "message has been rejected in filter: " + this);
}
else if (channelToDiscard == null) {
logger.warn(LogMessage.format("The message [%s] has been rejected in filter: %s", message, this));
}
}
return result;
}

Our flow is simple, it has this in the middle of it:

# SomeConfiguration.kt

@Bean
fun someFlow() =
    from(...)
    ...
    .filter(PayloadTypeSelector(...))
    .handle(...)
    .get()

This code hasn't changed and produced no warnings in Spring Boot 2.7.x.

Are we doing something wrong and/or have we missed something in the docs that says we need to do something special with filtered messages? Or is this just a bug of over-zealous logging?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidNot reproducable or not relevant to the current state of the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions