第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

評估異常:此命令處理器不支持“啟動”方法

評估異常:此命令處理器不支持“啟動”方法

郎朗坤 2023-06-21 13:39:28
我想使用 spring 集成開發(fā)控制總線示例。我決定做同樣的事情,但使用 java DSL?,F(xiàn)在我有以下源代碼:@Configuration@EnableIntegration@IntegrationComponentScanpublic class Config {? ? @Bean? ? public IntegrationFlow controlBusFlow() {? ? ? ? return IntegrationFlows.from("operationChannel")? ? ? ? ? ? ? ? .controlBus()? ? ? ? ? ? ? ? .get();? ? }? ? @Bean? ? @InboundChannelAdapter(channel = "adapterOutputChanel", autoStartup = "false", poller = @Poller(fixedDelay = "1000"))? ? public MessageSource<String> inboundAdapter() {? ? ? ? return new MessageSource<String>() {? ? ? ? ? ? @Override? ? ? ? ? ? public Message receive() {? ? ? ? ? ? ? ? return new Message() {? ? ? ? ? ? ? ? ? ? @Override? ? ? ? ? ? ? ? ? ? public String getPayload() {? ? ? ? ? ? ? ? ? ? ? ? return "some_output_message";? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? @Override? ? ? ? ? ? ? ? ? ? public MessageHeaders getHeaders() {? ? ? ? ? ? ? ? ? ? ? ? return null;? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? };? ? ? ? ? ? }? ? ? ? };? ? }? ? @Bean? ? public AbstractMessageChannel adapterOutputChanel() {? ? ? ? return new QueueChannel();? ? }}和應(yīng)用:@SpringBootApplicationpublic class MyApplication {? ? public static void main(String[] args) {? ? ? ? ConfigurableApplicationContext ctx = new SpringApplication(MyApplication.class).run(args);? ? ? ? MessageChannel controlChannel = ctx.getBean("operationChannel", MessageChannel.class);? ? ? ? PollableChannel adapterOutputChanel = ctx.getBean("adapterOutputChanel", PollableChannel.class);? ? ? ? controlChannel.send(new GenericMessage<String>("@inboundAdapter.start()"));? ? ? ? adapterOutputChanel.receive(1000);? ? }}我有什么錯嗎?
查看完整描述

1 回答

?
紅顏莎娜

TA貢獻1842條經(jīng)驗 獲得超13個贊

根據(jù)Spring中的Java和Annotation配置,inboundAdapterbean名稱(本質(zhì)上是bean方法名稱)被準(zhǔn)確地分配給您聲明為bean的內(nèi)容。在您的情況下,它是一個MessageSource實現(xiàn)。您確實需要在控制總線命令中處理通過那個SourcePollingChannelAdapter分配給您的 bean?。唯一的問題是我們需要找出一個正確的 bean 名稱以從命令中引用它:MessageSource@InboundChannelAdapter

AbstractEndpoint bean 名稱使用以下模式生成:[configurationComponentName].[methodName].[decapitalizedAnnotationClassShortName]。例如,前面顯示的 consoleSource() 定義的 SourcePollingChannelAdapter 端點獲取 myFlowConfiguration.consoleSource.inboundChannelAdapter 的 bean 名稱。另請參見端點 Bean 名稱。

因此,我建議您參考端點 Bean 名稱@EndpointId建議,并與它一起使用@InboundChannelAdapter

@Bean

@InboundChannelAdapter(channel = "adapterOutputChanel", autoStartup = "false", poller = @Poller(fixedDelay = "1000"))

@EndpointId("myInboundAdapter")

public MessageSource<String> inboundAdapter() {

因此,您的控制總線命令將如下所示:"@myInboundAdapter.start()"


更新


用于連接的 Java DSL 變體MessageSource:


@Bean

public IntegrationFlow channelAdapterFlow() {

? ? return IntegrationFlows.from(new MyMessageSource(),?

? ? ? ? ? ? ? ? e -> e.id("myInboundAdapter").autoStartup(false).poller(p -> p.fixedDelay(100)))

? ? ? ? ? ? .channel(adapterOutputChanel())

? ? ? ? ? ? .get();

}


查看完整回答
反對 回復(fù) 2023-06-21
  • 1 回答
  • 0 關(guān)注
  • 131 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號