Skip to content

Commit 48e4215

Browse files
vishnu-alapatiVishnumagnusbaeck
authored
Overide the AMQP Basic Properties (#262)
* Overide the AMQP Basic Properties Co-authored-by: Vishnu <vishnu.alapati@ericsson.com> Co-authored-by: Magnus Bäck <magnus@noun.se>
1 parent 52cae51 commit 48e4215

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.0.28
2+
- Made changes to override AMQP Basic properties.
3+
14
## 2.0.27
25
- Degraded the spring-boot-maven-plugin version to 2.7.5
36
- Updated the eiffel-remrem-parent version to 2.0.9

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<version>2.0.9</version>
1010
</parent>
1111
<properties>
12-
<eiffel-remrem-publish.version>2.0.27</eiffel-remrem-publish.version>
12+
<eiffel-remrem-publish.version>2.0.28</eiffel-remrem-publish.version>
1313
<eiffel-remrem-semantics.version>2.2.4</eiffel-remrem-semantics.version>
1414
</properties>
1515
<artifactId>eiffel-remrem-publish</artifactId>

publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RabbitMqProperties.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public class RabbitMqProperties {
5959
private Long waitForConfirmsTimeOut;
6060
public static final Long DEFAULT_WAIT_FOR_CONFIRMS_TIMEOUT = 5000L;
6161
public static final Integer DEFAULT_CHANNEL_COUNT = 1;
62+
public static final String CONTENT_TYPE = "application/json";
63+
public static final String ENCODING_TYPE = "UTF-8";
64+
public static final BasicProperties PERSISTENT_BASIC_APPLICATION_JSON;
6265

6366
private Connection rabbitConnection;
6467
private String protocol;
@@ -67,6 +70,13 @@ public class RabbitMqProperties {
6770

6871
Logger log = (Logger) LoggerFactory.getLogger(RMQHelper.class);
6972

73+
static {
74+
PERSISTENT_BASIC_APPLICATION_JSON =
75+
MessageProperties.PERSISTENT_BASIC.builder()
76+
.contentType(CONTENT_TYPE)
77+
.contentEncoding(ENCODING_TYPE)
78+
.build();
79+
}
7080

7181
public Long getWaitForConfirmsTimeOut() {
7282
return waitForConfirmsTimeOut;
@@ -491,9 +501,9 @@ public void shutdownCompleted(ShutdownSignalException cause) {
491501
}
492502
}
493503
});
494-
BasicProperties msgProps = MessageProperties.BASIC;
495-
if (usePersitance)
496-
msgProps = MessageProperties.PERSISTENT_BASIC;
504+
BasicProperties msgProps = usePersitance ? PERSISTENT_BASIC_APPLICATION_JSON
505+
: MessageProperties.BASIC;
506+
497507
try {
498508
channel.basicPublish(exchangeName, routingKey, msgProps, msg.getBytes());
499509
log.info("Published message with size {} bytes on exchange '{}' with routing key '{}'",

0 commit comments

Comments
 (0)