You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/02/07 13:29:09 UTC
[GitHub] [camel] oscerd commented on a change in pull request #6897: aws2-ses: Add support for CC and BCC addresses
oscerd commented on a change in pull request #6897:
URL: https://github.com/apache/camel/pull/6897#discussion_r800653723
##########
File path: components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java
##########
@@ -148,15 +148,39 @@ private String determineReturnPath(Exchange exchange) {
return returnPath;
}
- private Destination determineTo(Exchange exchange) {
- String to = exchange.getIn().getHeader(Ses2Constants.TO, String.class);
- if (to == null) {
- to = getConfiguration().getTo();
+ private Destination determineDestination(Exchange exchange) {
+ List<String> to = determineRawTo(exchange);
+ List<String> cc = determineRawCc(exchange);
+ List<String> bcc = determineRawBcc(exchange);
+ return Destination.builder().toAddresses(to).ccAddresses(cc).bccAddresses(bcc).build();
+ }
+
+ private List<String> determineRawCc(Exchange exchange) {
+ String cc = exchange.getIn().getHeader(Ses2Constants.CC, String.class);
+ if (cc == null) {
Review comment:
Please use ObjectHelper to check for null
##########
File path: components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java
##########
@@ -148,15 +148,39 @@ private String determineReturnPath(Exchange exchange) {
return returnPath;
}
- private Destination determineTo(Exchange exchange) {
- String to = exchange.getIn().getHeader(Ses2Constants.TO, String.class);
- if (to == null) {
- to = getConfiguration().getTo();
+ private Destination determineDestination(Exchange exchange) {
+ List<String> to = determineRawTo(exchange);
+ List<String> cc = determineRawCc(exchange);
+ List<String> bcc = determineRawBcc(exchange);
+ return Destination.builder().toAddresses(to).ccAddresses(cc).bccAddresses(bcc).build();
+ }
+
+ private List<String> determineRawCc(Exchange exchange) {
+ String cc = exchange.getIn().getHeader(Ses2Constants.CC, String.class);
+ if (cc == null) {
+ cc = getConfiguration().getCc();
+ }
+ if (ObjectHelper.isNotEmpty(cc)) {
+ return Stream.of(cc.split(","))
+ .map(String::trim)
+ .collect(Collectors.toList());
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ private List<String> determineRawBcc(Exchange exchange) {
+ String bcc = exchange.getIn().getHeader(Ses2Constants.BCC, String.class);
+ if (bcc == null) {
Review comment:
same
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org