Hi everyone,

We are using the Camel Mail component to fetch mails from a mailbox. The camel 
exchange will provide the MimeMultipart Object in the exchange body.

We now see that every access to this MimeMulitpart will do a remote call to the 
mailserver. Is there any setting in camel that allows us to prevent this, i.e. 
by caching the data once it has been loaded?

Best regards,
Manuel

Example

Processor:
Each time getBody(String.class) is called, a remote calls to the mailserver are 
done.

public void process(Exchange exchange) throws Exception {
    System.out.println("TEST 1.\n" + 
exchange.getMessage().getBody(String.class));
    System.out.println("TEST 2.\n" + 
exchange.getMessage().getBody(String.class));
    System.out.println("TEST 3.\n" + 
exchange.getMessage().getBody(String.class));
}

After running above lines with debugMode=true, I can see the remote calls:

A13 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A13 OK Success
A14 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A14 OK Success
TEST 1.
This is a mail body



A15 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A15 OK Success
A16 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A16 OK Success
TEST 2.
This is a mail body



A17 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A17 OK Success
A18 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A18 OK Success
TEST 3.
This is a mail body

Reply via email to