首页 文章

在Spring Intgegration DSL中连接JDBC Store支持的两个队列通道

提问于
浏览
0

我正在尝试连接两个队列通道(由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();
    }
}

我试图在这两个通道之间放置不同的结构,但仍然有一个错误:

引起:java.lang.IllegalArgumentException:找到方法匹配的模糊参数类型[类java.lang.Void]:[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.configureMe trics(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)抛出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)]在org.springframework.util.Assert.isNull(Assert.java:155)〜[spring-core-5.0.1.RELEASE.jar:5.0 . 1.RELEASE]在org.springframework的org.springframework.integration.util.MessagingMethodInvokerHelper.findHandlerMethodsForTarget(MessagingMethodInvokerHelper.java:776)〜[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] . org.springframework.integration.util.MessagingMethodInvokerHelper中的integration.util.MessagingMethodInvokerHelper . (MessagingMethodInvokerHelper.java:379)〜[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] . (MessagingMethodInvokerHelper.java :225)〜[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] a org.springframework.integration.util.MessagingMethodInvokerHelper . (MessagingMethodInvokerHelper.java:220)〜[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1] org.springframework.integration.handler.MethodInvokingMessageProcessor . (MethodInvokingMessageProcessor.java:60)〜[spring-integration-core-5.0.0.RC1.jar:5.0.0.RC1]在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]在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.De moIntegration.flow(DemoIntegration.java:16)〜[classes /:na] at name.karwowski.blazej.integrationdemo2.DemoIntegration $$ EnhancerBySpringCGLIB $$ f82aadc3.CGLIB $ flow $ 0()〜[classes /:na]名称 . 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]在org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)〜[spring-context-5.0.1 . RELEASE.jar:5.0.1.RELEASE] atname.karwowski.blazej.integrationdemo2.DemoIntegration $$ EnhancerBySpringCGLIB $$ f82aadc3.flow()〜[classes /:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.8.0_151] at sun.reflect at.MativeMethodAccessorImpl.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] org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:155)〜[spring-beans-5.0.1.RELEASE . jar:5.0.1.RELEASE] ...省略了19个常用帧

如何正确连接两个(或更多)队列通道?我需要在它们之间进行一些处理,并允许应用程序在停止的情况下保留消息 .

完整的日志和代码示例在github上:https://github.com/blazejkarwowski/integration-test

1 回答

  • 2

    而不是 .handle(secondJDBCChannel) ,你必须使用 .channel(secondJDBCChannel) . 没有什么可以处理的 - 它介于两者之间 .

    有关详细信息,请参阅Reference Manual .

相关问题