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

@@ -1,88 +1,6 @@
Spring Integration Java DSL
===============================
The Spring Integration JavaConfig and DSL extension. Provides a set of convenient Builders and fluent API to configure
Spring Integration message flows from Spring `@Configuration` classes.
## Example Configurations
````java
@Configuration
@EnableIntegration
public class MyConfiguration {
@Bean
public MessageSource<?> integerMessageSource() {
MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject(new AtomicInteger());
source.setMethodName("getAndIncrement");
return source;
}
@Bean
public DirectChannel inputChannel() {
return new DirectChannel();
}
@Bean
public IntegrationFlow myFlow() {
return IntegrationFlows.from(this.integerMessageSource(), c -> c.poller(Pollers.fixedRate(100)))
.channel(this.inputChannel())
.filter((Integer p) -> p > 0)
.transform(Object::toString)
.channel(MessageChannels.queue())
.get();
}
}
````
As the result after `ApplicationContext` start up will be created Spring Integration endpoints and Message Channels as it is after XML parsing.
Such configuration can be used to replace XML configuration or together with that.
## Maven
### Repository
<repository>
<id>repository.springframework.maven.snapshot</id>
<name>Spring Framework Maven Snapshot Repository</name>
<url>http://repo.spring.io/libs-snapshot</url>
</repository>
### Artifact
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-dsl</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
## Support
Check out the [Spring Integration forums][] and the [spring-integration][spring-integration tag] tag
on [Stack Overflow][]. [Commercial support][] is available, too.
## Related GitHub projects
* [Spring Integration][]
* [Spring Integration Samples][]
* [Spring Integration Templates][]
* [Spring Integration Dsl Groovy][]
* [Spring Integration Dsl Scala][]
* [Spring Integration Pattern Catalog][]
For more information, please also don't forget to visit the [Spring Integration][] website.
[Spring Integration]: https://github.com/spring-projects/spring-integration
[Commercial support]: http://springsource.com/support/springsupport
[Spring Integration forums]: http://forum.spring.io/forum/spring-projects/integration
[spring-integration tag]: http://stackoverflow.com/questions/tagged/spring-integration
[Spring Integration Samples]: https://github.com/spring-projects/spring-integration-samples
[Spring Integration Templates]: https://github.com/spring-projects/spring-integration-templates/tree/master/si-sts-templates
[Spring Integration Dsl Groovy]: https://github.com/spring-projects/spring-integration-dsl-groovy
[Spring Integration Dsl Scala]: https://github.com/spring-projects/spring-integration-dsl-scala
[Spring Integration Pattern Catalog]: https://github.com/spring-projects/spring-integration-pattern-catalog
[Stack Overflow]: http://stackoverflow.com/faq
See the
[Spring Integration Java DSL Reference](https://github.com/spring-projects/spring-integration-extensions/wiki/Spring-Integration-Java-DSL-Reference)
for more info.

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")