Files
spring-cloud-stream/index.html
2016-05-09 13:23:52 +05:30

103 lines
3.7 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: Issues (Waffle)
url: https://waffle.io/spring-cloud/spring-cloud-stream
icon: tracking
- name: CI (Bamboo)
url: https://build.spring.io/browse/SCS
icon: ci
- name: StackOverflow
url: http://stackoverflow.com/questions/tagged/spring-cloud-stream
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 is a framework for building message-driven microservices. Spring Cloud Stream builds upon Spring Boot to create DevOps friendly microservice applications and Spring Integration to provide connectivity to message brokers. Spring Cloud Stream provides an opinionated configuration of message brokers, introducing the concepts of persistent pub/sub semantics, consumer groups and partitions across several middleware vendors. This opinionated configuration provides the basis to create stream processing applications.
By adding @EnableBinding to your main application, you get immediate connectivity to a message broker and by adding @StreamListener to a method, you will receive events for stream processing.
{% 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 Cloud Stream binder are on the
classpath any Spring Boot application with `@EnableBinding` will bind to an external broker provided by the bus (e.g. Rabbit MQ or Kafka, depending on the implementation you choose). Sample application:
Head over to http://start.spring.io and create a project with the 'Stream Kafka' dependency. Modify the main class as shown below:
```java
@SpringBootApplication
@EnableBinding(Source.class)
public class StreamdemoApplication {
public static void main(String[] args) {
SpringApplication.run(StreamdemoApplication.class, args);
}
@Bean
@InboundChannelAdapter(value = Source.OUTPUT)
public MessageSource<String> timerMessageSource() {
return () -> new GenericMessage<>(new SimpleDateFormat().format(new Date()));
}
}
```
Make sure Kafka is running when you run the application. You can use the `kafka-console-consumer.sh` utility provided by Kafka to monitor messages sent on the `output` topic.
{% endcapture %}
{% capture related_resources %}
### Sample Projects
* [Source](https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/source)
* [Sink](https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/sink)
* [Transformer](https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/transform)
* [Multi-binder](https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/multibinder)
* [RxJava Processor](https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/rxjava-processor)
### Related Projects
* [Spring Cloud Stream Applications](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>