This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 6dd43e0e8b84 CAMEL-24238: camel-aws2-ses - send RawMessage body
content instead of the SdkBytes descriptor (#25015)
6dd43e0e8b84 is described below
commit 6dd43e0e8b846322afaba2a9a6d7dd8b347440fc
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Jul 23 15:22:10 2026 +0200
CAMEL-24238: camel-aws2-ses - send RawMessage body content instead of the
SdkBytes descriptor (#25015)
When the exchange body is an SES RawMessage, Ses2Producer built the outgoing
Content from the body converted to String, which for a RawMessage falls back
to Object.toString() on the SDK type. SdkBytes.toString() renders a debug
descriptor ("SdkBytes(bytes=0x46726f6d...)"), so the recipient received that
descriptor instead of the MIME payload.
Read the payload from RawMessage.data().asUtf8String() when the body is a
RawMessage, and cover it with a test asserting the sent text equals the
original MIME content.
Signed-off-by: Andrea Cosentino <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
---
components/camel-aws/camel-aws2-ses/pom.xml | 5 +++++
.../org/apache/camel/component/aws2/ses/Ses2Producer.java | 3 ++-
.../apache/camel/component/aws2/ses/SesComponentTest.java | 14 ++++++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/components/camel-aws/camel-aws2-ses/pom.xml
b/components/camel-aws/camel-aws2-ses/pom.xml
index 475117669bfb..ec87e4e4d994 100644
--- a/components/camel-aws/camel-aws2-ses/pom.xml
+++ b/components/camel-aws/camel-aws2-ses/pom.xml
@@ -83,5 +83,10 @@
<artifactId>camel-test-spring-junit6</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git
a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java
b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java
index 4b1ef57e797b..d84a5adbc0b4 100644
---
a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java
+++
b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java
@@ -101,7 +101,8 @@ public class Ses2Producer extends DefaultProducer {
= software.amazon.awssdk.services.ses.model.Message.builder();
String content;
if (exchange.getIn().getBody() instanceof RawMessage raw) {
- content = raw.data().toString();
+ // SdkBytes.toString() is a debug descriptor
(SdkBytes(bytes=0x...)), not the payload
+ content = raw.data().asUtf8String();
} else {
content = exchange.getIn().getBody(String.class);
}
diff --git
a/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentTest.java
b/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentTest.java
index 1ba9aa3de35a..021800773783 100644
---
a/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentTest.java
+++
b/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentTest.java
@@ -26,9 +26,12 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.services.ses.model.MessageTag;
+import software.amazon.awssdk.services.ses.model.RawMessage;
import software.amazon.awssdk.services.ses.model.SendEmailRequest;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
public class SesComponentTest extends CamelTestSupport {
@@ -36,6 +39,17 @@ public class SesComponentTest extends CamelTestSupport {
@BindToRegistry("amazonSESClient")
private AmazonSESClientMock sesClient = new AmazonSESClientMock();
+ @Test
+ void rawMessageBodyIsSentAsItsContentNotTheSdkBytesDescriptor() {
+ String mime = "From: [email protected]\r\nSubject: Subject\r\n\r\nThis
is my message text.";
+ template.send("direct:start", exchange -> exchange.getIn().setBody(
+
RawMessage.builder().data(SdkBytes.fromUtf8String(mime)).build()));
+
+ // SdkBytes.toString() would yield "SdkBytes(bytes=0x...)" rather than
the message content
+ String sent =
sesClient.getSendEmailRequest().message().body().text().data();
+ assertThat(sent).isEqualTo(mime);
+ }
+
@Test
public void sendInOnlyMessageUsingUrlOptions() {
Exchange exchange = template.send("direct:start", new Processor() {