Skip to content

Make Function<MimeMessage, ?> as CheckedFunction in Mail Java DSL #11280

Description

@artembilan

So far I see the problem here:

public ImapIdleChannelAdapterSpec selector(Function<MimeMessage, Boolean> selectorFunction) {

And in the similar method of the MailInboundChannelAdapterSpec:

public S selector(Function<MimeMessage, Boolean> selectorFunction) {

The point is that most of MimeMessage API throws unchecked: jakarta.mail.MessagingException.
That is a bit inconvenient for lambda-based configuration.

The solution is to use org.springframework.integration.util.CheckedFunction.
Something similar has been fixed in JMS Java DSL a while ago. See JmsInboundGatewaySpec:

public S replyToFunction(CheckedFunction<Message, ? extends @Nullable Object, JMSException> replyToFunction) {

More info in the PR related to: #3957.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions