R.Groote
R.Groote

Reputation: 98

Create PDF and send mail through apache camel

We have the following scenario:

In the camel configuration:

Questions

Any suggestions would be very help full.

I tried it with the below camel configuration but within the merge strategy the zip is never present. It looks like there is no response from the createZip route

        <camel:multicast strategyRef="mergeStrategy">
            <camel:to uri="direct:createZip"/>
            <camel:to uri="direct:createRequestMessage"/>
        </camel:multicast>

        <camel:to uri="smtp://[email protected]"></camel:to>
    </camel:route>

    <camel:route>
        <camel:from uri="direct:createZip" />
        <camel:from uri="file:////data/tmp/zip/input">
            <camel:description>Reading files from the input folder</camel:description>
        </camel:from>

        <camel:aggregate strategyRef="zipStrategy" eagerCheckCompletion="true" completionFromBatchConsumer="true">
            <camel:correlationExpression>
                <camel:constant>true</camel:constant>
            </camel:correlationExpression>

            <camel:setHeader headerName="dummybody">
                <camel:simple>${body}</camel:simple>
            </camel:setHeader>
        </camel:aggregate>

        <camel:setHeader headerName="Strategy-Attachment">
            <camel:constant>true</camel:constant>
        </camel:setHeader>

    </camel:route>


    <camel:route>
        <camel:from uri="direct:createRequestMessage" />
        <camel:to uri="create_request.xslt?saxon=true" />
        <camel:setHeader headerName="Content-Type">
            <camel:constant>text/html</camel:constant>
        </camel:setHeader>
        <camel:setHeader headerName="Strategy-Body">
            <camel:constant>true</camel:constant>
        </camel:setHeader>
    </camel:route>

Upvotes: 0

Views: 1621

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55555

Your route with direct:createZip is wrong, you cannot really have 2 x from in the same route. Instead what you should do is to use the Content Enricher EIP pattern: http://camel.apache.org/content-enricher.html

There is a <pollEnrich> you can use to consume the file. Mind about what to do if there is no file, then you need to set a timeout. So read the documentation about this.

Upvotes: 1

Related Questions