gpt4 book ai didi

java - Spring:如何使用注释配置 Messaging Bridge 轮询器

转载 作者:行者123 更新时间:2023-12-02 02:49:53 28 4
gpt4 key购买 nike

我希望能够限制从我的 SubscribableChannel 收到的请求。我不使用 PollableChannel。我能做等价的事情吗:

<bridge input-channel="pollable" output-channel="subscribable">
<poller max-messages-per-poll="10">
<interval-trigger interval="5" time-unit="SECONDS"/>
</poller>
</bridge>

http://docs.spring.io/spring-integration/docs/2.0.0.M4/spring-integration-reference/html/bridge.html

使用注释?

最佳答案

使用桥处理程序...

@Bean
@ServiceActivator(inputChannel = "polled",
poller = @Poller(fixedRate = "5000", maxMessagesPerPoll = "10"))
public BridgeHandler bridge() {
BridgeHandler bridge = new BridgeHandler();
bridge.setOutputChannelName("direct");
return bridge;
}

...或者只是...

@Bean
@BridgeTo(value = "direct", poller = @Poller(fixedDelay = "5000", maxMessagesPerPoll = "10"))
public PollableChannel polled() {
return new QueueChannel();
}

@Bean
public SubscribableChannel direct() {
return new DirectChannel();
}

@Bean
public PollableChannel polled() {
return new QueueChannel();
}

@Bean
@BridgeFrom(value = "polled", poller = @Poller(fixedDelay = "5000", maxMessagesPerPoll = "10"))
public SubscribableChannel direct() {
return new DirectChannel();
}

关于java - Spring:如何使用注释配置 Messaging Bridge 轮询器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44016599/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com