Skip to content

Commit

Permalink
Fix AbstractAwsMessageHandler impls for explicit headerMapper set…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
artembilan committed Sep 24, 2024
1 parent 5cfdaa2 commit 577c2e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public abstract class AbstractAwsMessageHandler<H> extends AbstractMessageProduc

private HeaderMapper<H> headerMapper;

private boolean headerMapperSet;

public void setSendTimeout(long sendTimeout) {
setSendTimeoutExpression(new ValueExpression<>(sendTimeout));
}
Expand All @@ -84,6 +86,11 @@ protected Expression getSendTimeoutExpression() {
*/
public void setHeaderMapper(HeaderMapper<H> headerMapper) {
this.headerMapper = headerMapper;
this.headerMapperSet = true;
}

protected boolean isHeaderMapperSet() {
return this.headerMapperSet;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ public void setBodyExpression(Expression bodyExpression) {
@Override
protected void onInit() {
super.onInit();
setHeaderMapper(new SnsHeaderMapper());
if (!isHeaderMapperSet()) {
setHeaderMapper(new SnsHeaderMapper());
}
TypeLocator typeLocator = getEvaluationContext().getTypeLocator();
if (typeLocator instanceof StandardTypeLocator standardTypeLocator) {
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ public void setMessageConverter(MessageConverter messageConverter) {
@Override
protected void onInit() {
super.onInit();
setHeaderMapper(new SqsHeaderMapper());
if (!isHeaderMapperSet()) {
setHeaderMapper(new SqsHeaderMapper());
}
if (this.messageConverter == null) {
this.messageConverter = new GenericMessageConverter(getConversionService());
}
Expand Down

0 comments on commit 577c2e8

Please sign in to comment.