Refine Reactor-based TCP client implementation

Configure explicitly use of SynchronousDispatcher instead of the one
used otherwise by default (RingBufferDispatcher). As a result TCP
optations are now scoped to Netty's threads.

Remove Environment field. It is no longer required to shut it down
since we're now using SynchronousDispatcher by default.

Replace connection.in() with connection.consume() when composing
connection handling. The former creates a Stream for further composing,
e.g. via map(), filter() but all we need is to read a message.

Provide additional constructor that aceepts a pre-configured Reactor
TcpClient instance.

Issue: SPR-11531
This commit is contained in:
Rossen Stoyanchev
2014-03-16 18:02:27 -04:00
parent 6bcbb94aba
commit 2e13bf8b81
3 changed files with 63 additions and 44 deletions

View File

@@ -68,10 +68,10 @@ public class BrokerMessageHandlerTests {
}
@Test
public void stopShouldPublishBrokerAvailabilityEvent() {
public void startAndStopShouldNotPublishBrokerAvailabilityEvents() {
this.handler.start();
this.handler.stop();
assertEquals(Arrays.asList(true, false), this.handler.availabilityEvents);
assertEquals(Collections.emptyList(), this.handler.availabilityEvents);
}
@Test
@@ -136,11 +136,6 @@ public class BrokerMessageHandlerTests {
setApplicationEventPublisher(this);
}
@Override
protected void startInternal() {
publishBrokerAvailableEvent();
}
@Override
protected void handleMessageInternal(Message<?> message) {
this.messages.add(message);