0
votes

I'm trying to connect two Queue Channels (backed by JDBC Store).

@Configuration
public class DemoIntegration {
    @Bean
    public IntegrationFlow flow(MessageChannel firstJDBCChannel,
                                MessageChannel secondJDBCChannel) {
        return IntegrationFlows.from(firstJDBCChannel)
                .bridge(bridgeHandler -> bridgeHandler.poller(p -> p.fixedDelay(100L)))
                .handle(secondJDBCChannel)
                .get();
    }
}

I tried to put different constructions between this two channels and still have an error like:

Caused by: java.lang.IllegalArgumentException: Found ambiguous parameter type [class java.lang.Void] for method match: [public boolean org.springframework.integration.channel.AbstractPollableChannel.removeInterceptor(org.springframework.messaging.support.ChannelInterceptor), public org.springframework.messaging.Message org.springframework.integration.channel.AbstractPollableChannel.receive(long), public final void org.springframework.integration.context.IntegrationObjectSupport.setPrimaryExpression(org.springframework.expression.Expression), public void org.springframework.integration.channel.AbstractMessageChannel.setStatsEnabled(boolean), public void org.springframework.integration.channel.AbstractMessageChannel.setMessageConverter(org.springframework.messaging.converter.MessageConverter), public void org.springframework.integration.channel.AbstractMessageChannel.setDatatypes(java.lang.Class...), public void org.springframework.integration.channel.AbstractMessageChannel.configureMetrics(org.springframework.integration.support.management.AbstractMessageChannelMetrics), public void org.springframework.integration.context.IntegrationObjectSupport.setComponentName(java.lang.String), public org.springframework.messaging.support.ChannelInterceptor org.springframework.integration.channel.AbstractPollableChannel.removeInterceptor(int), public void org.springframework.integration.context.IntegrationObjectSupport.setMessageBuilderFactory(org.springframework.integration.support.MessageBuilderFactory), public java.util.List> org.springframework.integration.channel.QueueChannel.purge(org.springframework.integration.core.MessageSelector), public void org.springframework.integration.context.IntegrationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext) throws org.springframework.beans.BeansException, public void org.springframework.integration.context.IntegrationObjectSupport.setBeanFactory(org.springframework.beans.factory.BeanFactory), public org.springframework.expression.Expression org.springframework.integration.context.IntegrationObjectSupport.getExpression(), public void org.springframework.integration.channel.AbstractPollableChannel.setInterceptors(java.util.List), public void org.springframework.integration.context.IntegrationObjectSupport.setChannelResolver(org.springframework.messaging.core.DestinationResolver)] at org.springframework.util.Assert.isNull(Assert.java:155) ~[spring-core-5.0.1.RELEASE.jar:5.0.1.RELEASE] at org.springframework.integration.util.MessagingMethodInvokerHelper.findHandlerMethodsForTarget(MessagingMethodInvokerHelper.java:776) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.util.MessagingMethodInvokerHelper.(MessagingMethodInvokerHelper.java:379) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.util.MessagingMethodInvokerHelper.(MessagingMethodInvokerHelper.java:225) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.util.MessagingMethodInvokerHelper.(MessagingMethodInvokerHelper.java:220) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.handler.MethodInvokingMessageProcessor.(MethodInvokingMessageProcessor.java:60) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.handler.ServiceActivatingHandler.(ServiceActivatingHandler.java:38) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:924) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:904) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:891) ~[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] at name.karwowski.blazej.integrationdemo2.DemoIntegration.flow(DemoIntegration.java:16) ~[classes/:na] at name.karwowski.blazej.integrationdemo2.DemoIntegration$$EnhancerBySpringCGLIB$$f82aadc3.CGLIB$flow$0() ~[classes/:na] at name.karwowski.blazej.integrationdemo2.DemoIntegration$$EnhancerBySpringCGLIB$$f82aadc3$$FastClassBySpringCGLIB$$ef9b4b0c.invoke() ~[classes/:na] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.1.RELEASE.jar:5.0.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.1.RELEASE.jar:5.0.1.RELEASE] at name.karwowski.blazej.integrationdemo2.DemoIntegration$$EnhancerBySpringCGLIB$$f82aadc3.flow() ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:155) ~[spring-beans-5.0.1.RELEASE.jar:5.0.1.RELEASE] ... 19 common frames omitted

How to correctly connect two (or more) queue channels? I need to make some processing between them and allow application to retain messages in case of stop.

Full log and code sample are on github: https://github.com/blazejkarwowski/integration-test

1

1 Answers

2
votes

Instead of .handle(secondJDBCChannel) you have to use .channel(secondJDBCChannel). There is nothing to handle - it is a Channel in between.

See Reference Manual for more info.