Spring integration Spring集成了几个MessageHandler

Spring integration Spring集成了几个MessageHandler,spring-integration,message-handlers,Spring Integration,Message Handlers,我是Spring集成的新手,在这里找不到类似的帖子。 现在我有一个messageHandler,它调用特定的URI并写入通道 @Bean @Scope("prototype") public MessageHandler httpGateway() { if (checkURLs()) { LOG.error("REST URLS are not configured"); return null;

我是Spring集成的新手,在这里找不到类似的帖子。 现在我有一个messageHandler,它调用特定的URI并写入通道

@Bean
    @Scope("prototype")
    public MessageHandler httpGateway() {
        if (checkURLs()) {
            LOG.error("REST URLS are not configured");
            return null;
        }
        CredentialsProvider credsProvider = createCredentials();
        CloseableHttpClient httpclient = createHttpClient(credsProvider);
        HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(httpclient);
        HttpRequestExecutingMessageHandler httpHandler = createHttpRequestHandler(httpRequestFactory, requestURL);
        return httpHandler;
    }

private HttpRequestExecutingMessageHandler createHttpRequestHandler(HttpComponentsClientHttpRequestFactory httpRequestFactory, String request) {
        HttpRequestExecutingMessageHandler httpHandler = null;
        try {
            httpHandler = new HttpRequestExecutingMessageHandler(new URI(request));
        } catch (URISyntaxException e) {
            LOG.error(e.toString(), e);
        }
        httpHandler.setExpectedResponseType(String.class);
        httpHandler.setRequestFactory(httpRequestFactory);
        httpHandler.setHttpMethod(HttpMethod.GET);
        return httpHandler;
    }
和集成流

@Bean
public IntegrationFlow esbFlow(MessageHandler httpGateway) {
    if (checkURLs()) {
        LOG.error("REST URLS are not configured create flow without fetching");
        return null;
    }
    return IntegrationFlows
            .from(integerMessageSource(), c -> c.poller(Pollers.cron(pollerCron)))
            .channel(TRIGGER_CHANNEL)
            .handle(httpGateway)
            .filter(p -> p instanceof String, f -> f.discardChannel(ESB_JSON_ERROR_CHANNEL))
            .channel(ESB_JSON_PARSING_CHANNEL)
            .get();
}

现在,我必须扩展这个函数,以便调用一个额外的URL。据我所知,MessageHandler在IntegrationFlow中只能调用一个URL和handle函数,只能调用一个MessageHandler。

使用发布-订阅频道,并向其订阅两个子流;看


顺便说一句,
@Scope(“prototype”)
不适用于spring integration Bean。

使用发布-订阅频道并向其订阅两个子流;看

顺便说一句,
@Scope(“prototype”)
不适用于spring集成bean