DSL: Clean up README.md

This commit is contained in:
Artem Bilan
2014-05-08 14:15:15 +03:00
parent 6664d413d4
commit 4aefd9129f
2 changed files with 38 additions and 87 deletions

View File

@@ -77,6 +77,7 @@ import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.config.GlobalChannelInterceptor;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.dsl.AggregatorSpec;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.ResequencerSpec;
@@ -272,6 +273,10 @@ public class IntegrationFlowTests {
@Qualifier("priorityReplyChannel")
private PollableChannel priorityReplyChannel;
@Autowired
@Qualifier("lamdasInput")
private MessageChannel lamdasInput;
@BeforeClass
public static void setup() throws IOException {
mongodExe = MongodStarter.getDefaultInstance()
@@ -440,6 +445,26 @@ public class IntegrationFlowTests {
assertEquals("Hello, world", receive.getPayload());
}
@Test
public void testLamdas() {
QueueChannel replyChannel = new QueueChannel();
Message<?> message = MessageBuilder.withPayload("World")
.setHeader(MessageHeaders.REPLY_CHANNEL, replyChannel)
.build();
this.lamdasInput.send(message);
Message<?> receive = replyChannel.receive(5000);
assertNotNull(receive);
assertEquals("Hello World", receive.getPayload());
message = MessageBuilder.withPayload("Spring")
.setHeader(MessageHeaders.REPLY_CHANNEL, replyChannel)
.build();
this.lamdasInput.send(message);
assertNull(replyChannel.receive(10));
}
@Test
public void testWrongConfigurationWithSpecBean() {
ConfigurableApplicationContext context = null;
@@ -826,7 +851,7 @@ public class IntegrationFlowTests {
.get();
}
@Bean(name = PollerMetadata.DEFAULT_POLLER_METADATA_BEAN_NAME)
@Bean(name = PollerMetadata.DEFAULT_POLLER)
public PollerMetadata poller() {
return Pollers.fixedRate(500).get();
}
@@ -895,7 +920,7 @@ public class IntegrationFlowTests {
@Bean
public IntegrationFlow priorityFlow(PriorityCapableChannelMessageStore mongoDbChannelMessageStore) {
return IntegrationFlows.from(MessageChannels.priority("priorityChannel",
mongoDbChannelMessageStore, "priorityGroup"))
mongoDbChannelMessageStore, "priorityGroup").interceptor())
.bridge(s -> s.poller(Pollers.fixedDelay(1000, 2000)))
.channel(MessageChannels.queue("priorityReplyChannel"))
.get();
@@ -1050,6 +1075,14 @@ public class IntegrationFlowTests {
.get();
}
@Bean
public IntegrationFlow lamdasFlow() {
return IntegrationFlows.from("lamdasInput")
.filter("World"::equals)
.transform("Hello "::concat)
.get();
}
@Bean
public IntegrationFlow enricherFlow() {
return IntegrationFlows.fromFixedMessageChannel("enricherInput")