How to use PollerSpec in IntegrationFlowDefinition.bridge() properly with PollerMetadata.DEFAULT_POLLER?

前提是你 提交于 2021-02-11 14:54:27

问题


I am building an integration which has one main flow(start), and 2 sub flows. Main start flow is just to get property information, that is needed for both sub flows. After getting property info, it needs to subscribe different sub flows(startFlow1, startFlow2). And these different sub flows have to work in different times. See the example implementation below;


    @Bean(name = PollerMetadata.DEFAULT_POLLER)
    public PollerMetadata poller() {
        return Pollers.fixedRate(300, TimeUnit.SECONDS, 10).get();
    }

    @Bean
    QueueChannel queueChannel() {
        return new QueueChannel(1);
    }

    @Bean
    public IntegrationFlow start() {
        return IntegrationFlows
                .from("propertyCredential")
                .split()
                .publishSubscribeChannel(c -> c
                        .subscribe(startFlow1())
                        .subscribe(startFlow2()))
                .get();
    }

    @Bean
    public IntegrationFlow startFlow1() {
        return IntegrationFlows
                .from(queueChannel())
                .bridge(e -> e.poller(60, TimeUnit.SECONDS, 10))
                .transform()...
                .get();
    }

    @Bean
    public IntegrationFlow startFlow2() {
        return IntegrationFlows
                .from(queueChannel())
                .bridge(e -> e.poller(30, TimeUnit.SECONDS, 10))
                .transform()...
                .get();
    }

In my implementation, sub flows are following the default poller's specification. What is best solution for such cases?

来源:https://stackoverflow.com/questions/61936422/how-to-use-pollerspec-in-integrationflowdefinition-bridge-properly-with-poller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!