javascript
java集成spring,Spring集成
為了提高性能,我建議使用帶有任務 Actuator 的executorchannel來控制線程池大小的數(shù)量 . 通過這種方式,您可以獲得消息到達jms隊列時消費者接收消息并在單獨的線程中處理流的情況 . 請記住,在這種配置中,多線程工作由taskexecutor通道執(zhí)行taht將在單獨的線程中執(zhí)行消息的重新生成,因此您已經(jīng)想到了您想要的多線程等級 .
對于隊列消息通道,確實需要輪詢器在通道上輪詢以執(zhí)行recive,隊列容量是幕后原子隊列的容量 .
您可以在xml中以這種方式配置執(zhí)行程序通道
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xmlns:tx="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
或者以這種方式在java-dsl中
@Bean
public IntegrationFlow storeBookPageByPage(ConnectionFactory connectionFactory,
@Qualifier("createBookQueue") Destination createBookQueue,
@Qualifier("createBookResultQueue") Destination createBookResultQueue,
PdfBookMasterRepository pdfBookMasterRepository,
BookRepository bookRepository){
String tempFilePathBaseDir = environment.getProperty("bookService.storeBookPageByPage.tempFilePathBaseDir");
return IntegrationFlows.from(Jms.messageDriverChannelAdapter(connectionFactory)
.destination(createBookQueue)
.errorChannel(storeBookPageByPageErrorChannel()))
.channel(channels -> channels.executor(Executors.newScheduledThreadPool(5)))
.....
}
總結(jié)
以上是生活随笔為你收集整理的java集成spring,Spring集成的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 信号处理:谱密度
- 下一篇: 信号处理:希尔伯特黄变换