Skip to content

Commit

Permalink
Fix Checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
cgendreau committed Feb 6, 2024
1 parent f062050 commit 90daed9
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ca.gc.aafc.dina.messaging.config;

import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
Expand All @@ -14,8 +13,6 @@
import javax.inject.Inject;
import lombok.extern.log4j.Log4j2;

import com.rabbitmq.client.ReturnCallback;

/**
* Configuration of RabbitMQ related beans
*/
Expand Down Expand Up @@ -62,10 +59,11 @@ public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
// tell RabbitMQ that messages need to be delivered
rabbitTemplate.setMandatory(true);

if( returnCallback != null) {
if (returnCallback != null) {
rabbitTemplate.setReturnsCallback(returnCallback);
} else{
rabbitTemplate.setReturnsCallback( returned -> log.error("Can't deliver message {}", returned.getMessage()));
} else {
rabbitTemplate.setReturnsCallback(
returned -> log.error("Can't deliver message {}", returned.getMessage()));
}

return rabbitTemplate;
Expand Down

0 comments on commit 90daed9

Please sign in to comment.