FINERACT-1694-Asynchronous-Message-OutChannel-Rename

This commit is contained in:
Ruchi Dhamankar
2022-10-03 22:35:16 +02:00
committed by Aleksandar Vidakovic
parent 40b6eb50f6
commit 44cab78cbb
4 changed files with 12 additions and 12 deletions
@@ -39,14 +39,14 @@ import org.springframework.integration.jms.dsl.Jms;
public class ExternalEventJMSProducerConfiguration { public class ExternalEventJMSProducerConfiguration {
@Autowired @Autowired
private DirectChannel outboundRequests; private DirectChannel outboundRequestsEvents;
@Autowired @Autowired
private FineractProperties fineractProperties; private FineractProperties fineractProperties;
@Bean @Bean
public IntegrationFlow outboundFlow(ActiveMQConnectionFactory connectionFactory) { public IntegrationFlow outboundFlowEvents(ActiveMQConnectionFactory connectionFactory) {
return IntegrationFlows.from(outboundRequests) // return IntegrationFlows.from(outboundRequestsEvents) //
.log(LoggingHandler.Level.DEBUG) // .log(LoggingHandler.Level.DEBUG) //
.handle(Jms.outboundAdapter(connectionFactory) .handle(Jms.outboundAdapter(connectionFactory)
.destination(fineractProperties.getEvents().getExternal().getProducer().getJms().getEventQueueName())) .destination(fineractProperties.getEvents().getExternal().getProducer().getJms().getEventQueueName()))
@@ -30,7 +30,7 @@ import org.springframework.integration.config.EnableIntegration;
public class ExternalEventProducerConfiguration { public class ExternalEventProducerConfiguration {
@Bean @Bean
public DirectChannel outboundRequests() { public DirectChannel outboundRequestsEvents() {
return new DirectChannel(); return new DirectChannel();
} }
} }
@@ -27,6 +27,6 @@ import org.springframework.integration.annotation.MessagingGateway;
@ConditionalOnProperty(value = "fineract.events.external.enabled", havingValue = "true") @ConditionalOnProperty(value = "fineract.events.external.enabled", havingValue = "true")
public interface ExternalEventProducer { public interface ExternalEventProducer {
@Gateway(requestChannel = "outboundRequests", replyTimeout = 2, requestTimeout = 200) @Gateway(requestChannel = "outboundRequestsEvents", replyTimeout = 2, requestTimeout = 200)
void sendEvent(byte[] message) throws AcknowledgementTimeoutException; void sendEvent(byte[] message) throws AcknowledgementTimeoutException;
} }
@@ -54,8 +54,8 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
public class EventsJMSIntegrationTest { public class EventsJMSIntegrationTest {
@Autowired @Autowired
@Qualifier("outboundRequests") @Qualifier("outboundRequestsEvents")
private DirectChannel outboundRequests; private DirectChannel outboundRequestsEvents;
@Autowired @Autowired
private ContextConfiguration.TestChannelInterceptor testChannelInterceptor; private ContextConfiguration.TestChannelInterceptor testChannelInterceptor;
@@ -65,7 +65,7 @@ public class EventsJMSIntegrationTest {
@Test @Test
public void testJmsDownstreamChannelIntegration() { public void testJmsDownstreamChannelIntegration() {
assertThat(outboundRequests.getSubscriberCount()).isEqualTo(1); assertThat(outboundRequestsEvents.getSubscriberCount()).isEqualTo(1);
} }
@Test @Test
@@ -74,7 +74,7 @@ public class EventsJMSIntegrationTest {
underTest.sendEvent(new byte[0]); underTest.sendEvent(new byte[0]);
underTest.sendEvent(new byte[0]); underTest.sendEvent(new byte[0]);
// then // then
assertTrue(outboundRequests.getInterceptors().contains(this.testChannelInterceptor)); assertTrue(outboundRequestsEvents.getInterceptors().contains(this.testChannelInterceptor));
assertThat(testChannelInterceptor.getInvoked()).isEqualTo(2); assertThat(testChannelInterceptor.getInvoked()).isEqualTo(2);
} }
@@ -87,19 +87,19 @@ public class EventsJMSIntegrationTest {
private static ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); private static ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
@Bean @Bean
public DirectChannel outboundRequests() { public DirectChannel outboundRequestsEvents() {
return new DirectChannel(); return new DirectChannel();
} }
@Bean @Bean
public IntegrationFlow outboundFlow() { public IntegrationFlow outboundFlow() {
return IntegrationFlows.from("outboundRequests") // return IntegrationFlows.from("outboundRequestsEvents") //
.log(LoggingHandler.Level.DEBUG) // .log(LoggingHandler.Level.DEBUG) //
.handle(Jms.outboundAdapter(connectionFactory).destination("destinationChannel")).get(); .handle(Jms.outboundAdapter(connectionFactory).destination("destinationChannel")).get();
} }
@Component @Component
@GlobalChannelInterceptor(patterns = "outboundRequests") @GlobalChannelInterceptor(patterns = "outboundRequestsEvents")
public static class TestChannelInterceptor implements ChannelInterceptor { public static class TestChannelInterceptor implements ChannelInterceptor {
private final AtomicInteger invoked = new AtomicInteger(); private final AtomicInteger invoked = new AtomicInteger();