package io.fundrequest.core.config;

import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.RetryTemplate;

@Configuration
public class JmsConfig {


    @Bean
    TopicExchange exchange() {
        return new TopicExchange("azrael-exchange");
    }

    @Bean
    RabbitTemplate approvedClaimRabbitTemplate(ConnectionFactory connectionFactory,
                                      @Value("${io.fundrequest.azrael.queue.approved-claim}") final String queueName) {
        RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
        rabbitTemplate.setQueue(queueName);
        rabbitTemplate.setExchange("azrael-exchange");
        RetryTemplate retryTemplate = new RetryTemplate();
        retryTemplate.setRetryPolicy(new SimpleRetryPolicy(5));
        rabbitTemplate.setRetryTemplate(retryTemplate);
        rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
        return rabbitTemplate;
    }


}

@@ -1045,78 +1045,28 @@
 .set
-Queue(queueName);%0A        rabbitTemplate.setExchange(%22azrael-exchange%22
+RoutingKey(queueName
 );%0A 

update jms config