Marco Bungart created CAMEL-24364:
-------------------------------------
Summary: camel-http removes attachment since camel 4.10.1
Key: CAMEL-24364
URL: https://issues.apache.org/jira/browse/CAMEL-24364
Project: Camel
Issue Type: Bug
Components: camel-http
Affects Versions: 4.10.1
Reporter: Marco Bungart
The following route:
{code:java}
from(
scheduler(SCHEDULER_ROUTE)
.delay(Duration.ofDays(1).toMillis())
.initialDelay(Duration.ofSeconds(2).toMillis()))
.process(exchange -> {
AttachmentMessage message = exchange.getMessage(AttachmentMessage.class);
message.addAttachment("my-attachment",
new DataHandler("Hello, world", "text/plain"));
})
.process(exchange ->
log.info(
"Attachment count before http: {}",
exchange.getMessage(AttachmentMessage.class).getAttachments().size()))
.to("http://localhost:4567/hello")
.log("body: ${body}")
.process(exchange ->
log.info(
"Attachment count after http: {}",
exchange.getMessage(AttachmentMessage.class).getAttachments().size())); {code}
produces with camel {{4.10.0}} the following output:
{code:java}
[ - scheduler://scheduler-route] MySchedulerRoute INFO
Attachment count before http: 1
[ - scheduler://scheduler-route] route1 INFO body:
hihihi
[ - scheduler://scheduler-route] MySchedulerRoute INFO
Attachment count after http: 1{code}
since camel {{4.10.1}} the following output is produced:
{code:java}
[ - scheduler://scheduler-route] MySchedulerRoute INFO
Attachment count before http: 1
[ - scheduler://scheduler-route] route1 INFO body:
hihihi
[ - scheduler://scheduler-route] MySchedulerRoute INFO
Attachment count after http: 0 {code}
(notice that the attachment is gone after the http call)
---
Reproducer: [https://github.com/turing85/camel-http]
branch {{main}} holds the "known good" (camel {{{}4.10.0{}}}), branch
{{camel-4.10.1}} holds the fault version (camel {{{}4.10.1{}}}).
To run the reproducer:
* start some HTTP mock on {{{}localhost{}}}, port {{4567}} that responds to a
{{GET /hello}} with {{200 OK}} and some body with {{{}text/plain{}}}.
* Run method {{main}} in class {{Application}}
FTR:
https://camel.zulipchat.com/#narrow/channel/257302-camel-quarkus/topic/camel-quarkus-http.20.22eating.22.20attachments/with/614946338
--
This message was sent by Atlassian Jira
(v8.20.10#820010)