Files
spring-cloud-stream/index.html
2015-10-21 11:17:58 -07:00

105 lines
3.2 KiB
HTML

---
# The name of your project
title: Spring Cloud Stream
badges:
# Specify your project's twitter handle, if any. Delete if none.
twitter: SpringCloudOSS
# Customize your project's badges. Delete any entries that do not apply.
custom:
- name: Source (GitHub)
url: https://github.com/spring-cloud/spring-cloud-stream
icon: github
- name: CI (Bamboo)
url: https://build.spring.io/browse/SCS
icon: ci
- name: StackOverflow
url: http://stackoverflow.com/questions/tagged/spring-cloud
icon: stackoverflow
---
<!DOCTYPE HTML>
<html lang="en-US">
<!-- Specify the parent of this project (or delete if none) to influence the rendering of the breadcrumb -->
{% capture parent_link %}
[Spring Cloud]({{ site.projects_site_url }}/spring-cloud)
{% endcapture %}
{% capture billboard_description %}
Spring Cloud Stream allows a user to develop and run messaging microservices using Spring Integration and run them locally, or in the cloud, or even on Spring XD. Just add `@EnableBinding` and run your app as a Spring Boot app (single application context). You just need to connect to the physical broker for the bus, which is automatic if the relevant bus implementation is available on the classpath.
{% endcapture %}
{% capture main_content %}
<span id="quick-start"></span>
## Quick Start
<script type="text/javascript">{% include custom.js %}</script>
{% include download_widget.md %}
As long as Spring Cloud Stream and a Spring XD Message Bus is on the
classpath any Spring Boot application with `@EnableBinding` will bind to an external broker provided by the bus (e.g. redis, rabbit, kafka, depending on the implementation you choose). Sample application:
```java
@SpringBootApplication
@EnableBinding(Source.class)
@ComponentScan(basePackageClasses=ModuleDefinition.class)
public class ModuleApplication {
public static void main(String[] args) throws InterruptedException {
SpringApplication.run(ModuleApplication.class, args);
}
}
@Configuration
public class ModuleDefinition {
@Value("${format}")
private String format;
@Bean
public MessageChannel output() {
return new DirectChannel();
}
@Bean
@InboundChannelAdapter(value = Source.OUTPUT, autoStartup = "false", poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
public MessageSource<String> timerMessageSource() {
return () -> new GenericMessage<>(new SimpleDateFormat(format).format(new Date()));
}
}
```
{% endcapture %}
{% capture related_resources %}
### Sample Projects
* [Source](https://github.com/spring-cloud/spring-cloud-stream/tree/master/spring-cloud-stream-samples/source)
* [Sink](https://github.com/spring-cloud/spring-cloud-stream/tree/master/spring-cloud-stream-samples/sink)
* [Transformer](https://github.com/spring-cloud/spring-cloud-stream/tree/master/spring-cloud-stream-samples/transformer)
* [Mashup](https://github.com/spring-cloud/spring-cloud-stream/tree/master/spring-cloud-stream-samples/extended)
### Related Projects
* [Spring Cloud Stream Modules](http://cloud.spring.io/spring-cloud-stream-modules/)
* [Spring Cloud Data Flow](http://cloud.spring.io/spring-cloud-dataflow/)
* [Spring XD]({{site.projects_site_url}}/spring-xd/)
{% endcapture %}
{% include project_page.html %}
</html>