INTSAMPLES-136 Async GW Promise/ListenableFuture

JIRA: https://jira.spring.io/browse/INTSAMPLES-136

Polishing - PR Comments

* Add `compile "org.projectreactor.spring:reactor-spring-context:$reactorSpringVersion"` dependency
to show a usage of `@EnableReactor`
* Make `async-gateway` project Java 8 compatible and replace inline implementations for callbacks to Lambdas
This commit is contained in:
Gary Russell
2014-08-30 10:42:44 +03:00
committed by Artem Bilan
parent 3296463fb8
commit b20a275a6a
8 changed files with 374 additions and 31 deletions

View File

@@ -0,0 +1,39 @@
##
# Dispatcher configuration
#
# Each dispatcher must be configured with a type:
#
# reactor.dispatchers.<name>.type = <type>
#
# Legal values for <type> are eventLoop, ringBuffer, synchronous, and threadPoolExecutor.
# Depending on the type, further configuration is be possible:
#
# reactor.dispatchers.<name>.size: eventLoop and threadPoolExecutor Dispatchers
# reactor.dispatchers.<name>.backlog: eventLoop, ringBuffer, and threadPoolExecutor Dispatchers
#
# A size less than 1 may be specified to indicate that the size should be the same as the number
# of CPUs.
# A thread pool executor dispatcher, named threadPoolExecutor
reactor.dispatchers.threadPoolExecutor.type = threadPoolExecutor
reactor.dispatchers.threadPoolExecutor.size = 100
# Backlog is how many Task objects to warm up internally
reactor.dispatchers.threadPoolExecutor.backlog = 100
# An event loop dispatcher, named eventLoop
reactor.dispatchers.eventLoop.type =
reactor.dispatchers.eventLoop.size = 0
reactor.dispatchers.eventLoop.backlog = 2048
# A ring buffer dispatcher, named ringBuffer
reactor.dispatchers.ringBuffer.type =
reactor.dispatchers.ringBuffer.backlog = 2048
# A work queue dispatcher, named workQueue
reactor.dispatchers.workQueue.type =
reactor.dispatchers.workQueue.size = 0
reactor.dispatchers.workQueue.backlog = 2048
# The dispatcher named ringBuffer should be the default dispatcher
reactor.dispatchers.default = threadPoolExecutor

View File

@@ -11,23 +11,18 @@
<int:gateway id="mathService"
service-interface="org.springframework.integration.samples.async.gateway.MathServiceGateway"
default-request-channel="requestChannel"/>
default-request-channel="requestChannel"
async-executor="executor" default-reply-timeout="0"/>
<int:channel id="requestChannel">
<int:queue/>
</int:channel>
<int:channel id="requestChannel" />
<int:filter input-channel="requestChannel" output-channel="calculatingChannel" expression="payload &gt; 100">
<int:poller fixed-rate="100" max-messages-per-poll="10" task-executor="executor"/>
</int:filter>
<int:channel id="calculatingChannel" >
<int:dispatcher task-executor="executor"/>
</int:channel>
<int:filter input-channel="requestChannel" output-channel="calculatingChannel" expression="payload gt 100" />
<int:channel id="calculatingChannel" />
<int:service-activator input-channel="calculatingChannel">
<bean class="org.springframework.integration.samples.async.gateway.MathService"/>
</int:service-activator>
<task:executor id="executor" pool-size="10"/>
<task:executor id="executor" pool-size="100" />
</beans>