GH-218: Fix logging for AbstMesAttrsHeaderMapper
Fixes https://github.com/spring-projects/spring-integration-aws/issues/218 The `AbstractMessageAttributesHeaderMapper` incorrectly logs only for SQS service. * Fix `logger` property to be a `protected` and not `static` to make it rely on the `getClass()` context * Fix logging message in the `fromHeaders()` from just `SQS` to `the current AWS service` **Cherry-pick to `2.5.x`**
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2022 the original author or authors.
|
||||
* Copyright 2018-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,13 +41,15 @@ import io.awspring.cloud.messaging.core.MessageAttributeDataTypes;
|
||||
* The {@link #toHeaders(Map)} is not supported.
|
||||
*
|
||||
* @param <A> the target message attribute type.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Christopher Smith
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AbstractMessageAttributesHeaderMapper<A> implements HeaderMapper<Map<String, A>> {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(SqsHeaderMapper.class);
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private volatile String[] outboundHeaderNames = {
|
||||
"!" + MessageHeaders.ID,
|
||||
@@ -104,10 +106,10 @@ public abstract class AbstractMessageAttributesHeaderMapper<A> implements Header
|
||||
getBinaryMessageAttribute(ByteBuffer.wrap((byte[]) messageHeaderValue)));
|
||||
}
|
||||
else {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn(String.format(
|
||||
if (this.logger.isWarnEnabled()) {
|
||||
this.logger.warn(String.format(
|
||||
"Message header with name '%s' and type '%s' cannot be sent as"
|
||||
+ " message attribute because it is not supported by SQS.",
|
||||
+ " message attribute because it is not supported by the current AWS service.",
|
||||
messageHeaderName, messageHeaderValue.getClass().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user