Apache Camel route: How do I filter messages with attachments?

34 Views Asked by At

How can i forward to a HTTP service only messages with an attachment?

My route is:

    @Bean
    public RouteBuilder routeBuilder() {
        return new RouteBuilder() {
            @Value("${myapp.service-uri}")
            String serviceUrl;

            @Value("${myapp.mail-uri}")
            String mailUri;

            @Override
            public void configure() {
                from(mailUri)
                        .split(new SplitAttachmentsExpression())
                        .toD(serviceUrl + "/${header.from}/${header.subject}");
            }
        };
    }

I'm already using SplitAttachmentsExpression() in order to post every single attachment separately.

The pom.xml is tied on org.apache.camel.springboot:camel-spring-boot-bom:4.3.0 and includes:

  <dependencies>
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-mail-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-http-starter</artifactId>
    </dependency>
0

There are 0 best solutions below