SlideShare a Scribd company logo
‹#›© 2016 Pivotal Software, Inc. All rights reserved. ‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices with
Spring Cloud Stream, Task,
and Data Flow
Toshiaki Maki (@making)
2016-11-18 Spring Day 2016
#springday #jsug
© 2016 Pivotal Software, Inc. All rights reserved.
Who am I ?
• Toshiaki Maki (@making) http://blog.ik.am
• Sr. Solutions Architect @Pivotal
• Spring Framework enthusiast
bit.ly/hajiboot2
© 2016 Pivotal Software, Inc. All rights reserved.
Input
Motivation
HTTP
TCP
S3
JDBC
Rabbit
JMS
Twitter
Syslog
Output
HDFS
Cassandra
HAWQ
Greenplum
JDBC
S3
TCP
Gemfire
❓❔❓
• Real Time Analysis
• Data Ingestion
• ETL Process
© 2016 Pivotal Software, Inc. All rights reserved.
Spring XD (eXtreme Data)
© 2016 Pivotal Software, Inc. All rights reserved.
Spring XD (eXtreme Data)
🤔
© 2016 Pivotal Software, Inc. All rights reserved.
Spring XD Architecture
Container Container
gpfdist
Cassandra
jms
http
ZooKeeper
Message Broker
XD Admin
stream1 = http | cassandra
stream2 = jms | gpfdist
On Metal/VMs
© 2016 Pivotal Software, Inc. All rights reserved.
Spring XD Architecture
Container Container
gpfdist
Cassandra
jms
http
ZooKeeper
Message Broker
XD Admin
stream1 = http | cassandra
stream2 = jms | gpfdist
On Metal/VMs
😇
© 2016 Pivotal Software, Inc. All rights reserved.
Spring XD Architecture
Container Container
gpfdist
Cassandra
jms
http
ZooKeeper
Message Broker
XD Admin
stream1 = http | cassandra
stream2 = jms | gpfdist
On Metal/VMs
© 2016 Pivotal Software, Inc. All rights reserved.
Modern Platforms
Cloud Foundry YARN Kubernetes Mesos
Docker Swarm Nomad OpenShift
© 2016 Pivotal Software, Inc. All rights reserved.
Cloud Native Redesign
•From multiple modules embedded in
a container to standalone
executable applications
•From our own runtime to delegating
to existing modern platforms
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
Microservice for each data processing
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
Microservice for each data processing
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
Microservice for each data processing
bound with
Message Brokers
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
Microservice for each data processing
bound with
Message Brokers
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
Microservice for each data processing
bound with
Message Brokers
on the modern platform
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
Microservice for each data processing
bound with
Message Brokers
on the modern platform
© 2016 Pivotal Software, Inc. All rights reserved.
Data Microservices
$ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' |
tr -d '[:punct:]' |
grep -v '[^a-z]‘ |
sort | uniq -c | sort -rn | head
Microservice for each data processing
bound with
Message Brokers
on the modern platform
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Data Flow
• Microservices-based Distributed Data Pipelines
•Long Lived Stream Applications
•Short Lived Task Applications
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Data Flow
• Microservices-based Distributed Data Pipelines
•Long Lived Stream Applications
•Short Lived Task Applications
Spring Cloud Stream
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Data Flow
• Microservices-based Distributed Data Pipelines
•Long Lived Stream Applications
•Short Lived Task Applications
Spring Cloud Stream
Spring Cloud Task
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Data Flow
• Microservices-based Distributed Data Pipelines
•Long Lived Stream Applications
•Short Lived Task Applications
Spring Cloud Stream
Spring Cloud Task
Orchestration
Layer
© 2016 Pivotal Software, Inc. All rights reserved.
Structure
Spring Cloud Data Flow
Spring Cloud Deployer (SPI)
Spring Cloud Stream Spring Cloud Task
Spring Integration Spring Boot Spring Batch
© 2016 Pivotal Software, Inc. All rights reserved.
Structure
Spring Cloud Data Flow
Spring Cloud Deployer (SPI)
Spring Cloud Stream Spring Cloud Task
Spring Integration Spring Boot Spring Batch
• Spring Cloud Deployer Local
• Spring Cloud Deployer Cloud Foundry
• Spring Cloud Deployer Yarn
• Spring Cloud Deployer Kubernetes
• Spring Cloud Deployer Mesos
© 2016 Pivotal Software, Inc. All rights reserved.
SCDF Deployment Platform
Spring Cloud Data Flow Server
Deployer SPI
REST API
SCDFShell SCDF Flo
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Data Flow Architecture
gpfdist
cassandra
jms
http
stream1 = http | cassandra
stream2 = jms | gpfdist
Message Broker
Data Flow Server DB
Platform Runtime
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Data Flow Architecture
gpfdist
cassandra
jms
http
stream1 = http | cassandra
stream2 = jms | gpfdist
Message Broker
Data Flow Server DB
Platform Runtime
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Stream
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Stream
• Event-driven microservice framework
• Built on battle-tested components (Spring Boot / Spring
Integration)
• Opinionated primitives for streaming applications
• Persistent Pub/Sub
• Consumer Groups
• Partitioning Support
• Pluggable messaging middleware bindings
source | processor | sink
© 2016 Pivotal Software, Inc. All rights reserved.
JJUG CCC in 2 weeks
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Stream Applications
Twitter Stream
Cassandra
java -jar twittersource.jar --server.port=8080
--consumerKey=XYZ --consumerSecret=ABC
--spring.cloud.stream.bindings.
output.destination=ingest
Source
Sink java -jar cassandrasink.jar --server.port=8081
--spring.cassandra.keyspace=tweet
--spring.cloud.stream.bindings.
input.destination=ingest
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Stream Applications
Twitter Stream
Cassandra
java -jar twittersource.jar --server.port=8080
--consumerKey=XYZ --consumerSecret=ABC
--spring.cloud.stream.bindings.
output.destination=ingest
Source
Sink java -jar cassandrasink.jar --server.port=8081
--spring.cassandra.keyspace=tweet
--spring.cloud.stream.bindings.
input.destination=ingest
Twitter
Stream Cassandraingest
© 2016 Pivotal Software, Inc. All rights reserved.
Message Binders
• @EnableBinding
• Binder Implementations
• Production-Ready
• Rabbit MQ
• Apache Kafka
• Experimental
• JMS
• Google PubSub
© 2016 Pivotal Software, Inc. All rights reserved.
Programming Model (Sink)
@SpringBootApplication

@EnableBinding(Sink.class)

public class DemoSinkApp {
@StreamListener(Sink.INPUT)

void receive(Message<String> message) {

System.out.println("Received " + message);

}

public static void main(String[] args) {

SpringApplication.run(DemoSinkApp.class, args);

}

}
© 2016 Pivotal Software, Inc. All rights reserved.
Sink
Properties (Sink)
spring.cloud.stream.bindings.input.destination=demo-strm
demo-
strm
input
© 2016 Pivotal Software, Inc. All rights reserved.
Programming Model (Source)
@SpringBootApplication @RestController
@EnableBinding(Source.class)

public class DemoSourceApp {

@Autowired Source source;
@GetMapping void send(@RequestParam String text) {

source.output()
.send(MessageBuilder.withPayload(text).build());

}

public static void main(String[] args) {

SpringApplication.run(DemoSourceApp.class, args);

}

}
© 2016 Pivotal Software, Inc. All rights reserved.
Programming Model (Source)
@SpringBootApplication @RestController
@EnableBinding(Source.class)

public class DemoSourceApp {
@Bean
@InboundChannelAdapter(channel = Source.OUTPUT, poller =
@Poller(fixedDelay = "1000", maxMessagesPerPoll = "1"))
MessageSource<String> source() {

return () -> MessageBuilder.withPayload("Hi").build());

}

public static void main(String[] args) {

SpringApplication.run(DemoSourceApp.class, args);

}}
© 2016 Pivotal Software, Inc. All rights reserved.
Properties (Source)
spring.cloud.stream.bindings.output.destination=demo-strm
demo-
strm
Source
output
© 2016 Pivotal Software, Inc. All rights reserved.
Binder (RabbitMQ)
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
demo-
strm
© 2016 Pivotal Software, Inc. All rights reserved.
Binder (Apache Kafka)
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
</dependency>
demo-
strm
© 2016 Pivotal Software, Inc. All rights reserved.
Sink
Pipeline
demo-
strm
input
Source
output
source | sink
© 2016 Pivotal Software, Inc. All rights reserved.
Programming Model (Processor)
@SpringBootApplication

@EnableBinding(Processor.class)

public class DemoProcessorApp {
@StreamListener(Processor.INPUT)
@SendTo(Processor.OUTPUT)

void receive(String text) {

return "[[" + text + "]]";

}

public static void main(String[] args) {

SpringApplication.run(DemoProcessorApp.class, args);

}

}
© 2016 Pivotal Software, Inc. All rights reserved.
Properties (Processor)
spring.cloud.stream.bindings.output.destination=my-source
spring.cloud.stream.bindings.input.destination=my-source
spring.cloud.stream.bindings.output.destination=my-proc
spring.cloud.stream.bindings.input.destination=my-proc
Source
Processor
Sink
© 2016 Pivotal Software, Inc. All rights reserved.
Pipeline
my-
source
Source
output source | processor | sink
Processor
output
input
my-proc
Sink
input
© 2016 Pivotal Software, Inc. All rights reserved.
Reactive API Support
@SpringBootApplication

@EnableBinding(Processor.class)

public class DemoProcessorRxApp {
@StreamListener @Output(Processor.OUTPUT)

public Flux<String> receive(@Input(Processor.INPUT)
Flux<String> stream) {

return stream.map(text -> "[[" + text + "]]");

}

public static void main(String[] args) {

SpringApplication.run(DemoProcessorRxApp.class, args);

}

}
© 2016 Pivotal Software, Inc. All rights reserved.
Reactive API Support
@StreamListener @Output(Processor.OUTPUT)

public Flux<AverageData> receive(@Input(Processor.INPUT)
Flux<SensorData> stream) {

return stream.window(Duration.ofSecond(20),
Duration.ofSecond(10))
.flatMap(win -> win.groupBy(sensor -> sensor.id))
.flatMap(group -> calcAverage(group));

}
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Stream App Starters
Source Processor Sink
file
ftp
gemfire
gemfire-cq
http
jdbc
jms
load-generator
loggregator
mail
mongodb
rabbit
s3
sftp
syslog
tcp
tcp-client
time
trigger
triggertask
twitterstream
bridge
filter
groovy-filter
groovy-
transform
httpclient
pommel
scriptable-
transform
splitter
tcp-client
transform
aggregate-
counter
cassandra
counter
field-value-
counter
file
ftp
gemfire
gpfdist
hfs
hdfs-dataset
jdbc
log
rabbit
redis-pubsub
router
s3
sftp
task-launcher-
local
task-lancher-
yarn
tcp
throughput
web socket
http://cloud.spring.io/spring-cloud-stream-app-starters/
© 2016 Pivotal Software, Inc. All rights reserved.
Stream Orchestration in SCDF
ingest = twitterstream | cassandra
dataflow:> stream create --name=ingest
--definition="twitterstream | cassandra"
dataflow:> stream deploy --name=ingest
|
© 2016 Pivotal Software, Inc. All rights reserved.
Import apps
dataflow:> app import --uri http://bit.ly/1-0-4-
GA-stream-applications-rabbit-maven
rabbit maven
kafka docker
stream-applications-
http://cloud.spring.io/spring-cloud-stream-app-starters/
© 2016 Pivotal Software, Inc. All rights reserved.
Register your own apps
dataflow:> app register --name foo --type source
--uri http://example.com/foo-source-1.0.jar
dataflow:> app register --name foo --type source
--uri maven://com.example:foo-source:1.0
dataflow:> app register --name foo --type source
--uri docker:myapps/foo-source:1.0
dataflow:> app register --name foo --type source
--uri file:///tmp/foo-source:1.0
© 2016 Pivotal Software, Inc. All rights reserved.
Instance Count
dataflow:> stream create --name=s1
--definition="http | work | hdfs"
dataflow:> stream deploy --name=s1 --
properties="app.http.count=2,app.work.count=3,app
.hdfs.count=4"
© 2016 Pivotal Software, Inc. All rights reserved.
Instance Count
http
work
hdfs
http
work
work
hdfs
hdfs
hdfs
LoadBalancer
© 2016 Pivotal Software, Inc. All rights reserved.
Resource Management
dataflow:> stream deploy --name=s1 --
properties="app.work.spring.cloud.deployer.cloudf
oundry.memory=2048"
© 2016 Pivotal Software, Inc. All rights reserved.
Resource Management
http
http
work
work
work
hdfs
hdfs
hdfs
hdfs
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Flo http://projects.spring.io/spring-flo/
© 2016 Pivotal Software, Inc. All rights reserved.
Stream Core Features
•Persistent Pub-Sub
•Consumer Group
•Partitioning Support
© 2016 Pivotal Software, Inc. All rights reserved.
Persistent Pub-Sub
HTTP Average Top Ns1.http s1.ave
Message Broker
© 2016 Pivotal Software, Inc. All rights reserved.
Persistent Pub-Sub
HTTP Average
HDFS
Top Ns1.http s1.ave
Message Broker
© 2016 Pivotal Software, Inc. All rights reserved.
Persistent Pub-Sub
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
© 2016 Pivotal Software, Inc. All rights reserved.
Persistent Pub-Sub
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
Persistent Pub-Sub
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}{"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
Persistent Pub-Sub
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
Persistent Pub-Sub
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":
{"id":1, "temperature":38} {"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
Average
Average
HDFS
HDFS
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}
Average
Average
HDFS
HDFS
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}{"id":1, "temperature":38}
Average
Average
HDFS
HDFS
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}
{"id":1, "temperature":38}
Average
Average
HDFS
HDFS
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}
{"id":1, "temperature":38}
Average
Average
HDFS
HDFS
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
😩
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}
{"id":1, "temperature":38}
Average
Average
HDFS
HDFS
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
😩
Consumer Group
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
{"id":1, "temperature":38}
{"id":1, "temperature":38}
Average
Average
HDFS
HDFS
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
{"id":1, "temperature":38}
😩
spring.cloud.stream.bindings.<channelName>.group=ave
Spring Cloud Stream
group is configured by default 😁
Spring Cloud Data Flow
Consumer Group
© 2016 Pivotal Software, Inc. All rights reserved.
Consumer Group
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
Average
Average
HDFS
HDFS
group=ave
group=hdfs
© 2016 Pivotal Software, Inc. All rights reserved.
Consumer Group
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
Average
Average
HDFS
HDFS
group=ave
group=hdfs
{"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
Consumer Group
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
Average
Average
HDFS
HDFS
group=ave
group=hdfs
{"id":1, "temperature":38}{"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
Consumer Group
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
Average
Average
HDFS
HDFS
group=ave
group=hdfs
{"id":1, "temperature":38}
{"id":1, "temperature":38}
© 2016 Pivotal Software, Inc. All rights reserved.
Consumer Group
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
Average
Average
HDFS
HDFS
group=ave
group=hdfs
{"id":1, "temperature":38}
{"id":1, "temperature":38} 🤓
© 2016 Pivotal Software, Inc. All rights reserved.
Consumer Group
HTTP Average
HDFS
Top N
Fault
Detection
s1.http s1.ave
Message Broker
Average
Average
HDFS
HDFS
group=ave
group=hdfs
{"id":1, "temperature":38}
{"id":1, "temperature":38} 🤓consumer group subscriptions
are durable 😁
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
😩
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
😩
Partitioning Support(Stateful Stream)
© 2016 Pivotal Software, Inc. All rights reserved.
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
😩stream deploy --name=xxxx --properties=
"app.http.producer.partitionKeyExpression=payload.id"
spring.cloud.stream.bindings.<channelName>.producer.par
titionKeyExpression=payload.id
Spring Cloud Stream
Spring Cloud Data Flow
Partitioning Support(Stateful Stream)
© 2016 Pivotal Software, Inc. All rights reserved.
Partitioning Support(Stateful Stream)
HTTP
Average
s1.http
Average
© 2016 Pivotal Software, Inc. All rights reserved.
Partitioning Support(Stateful Stream)
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
Partitioning Support(Stateful Stream)
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
Partitioning Support(Stateful Stream)
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
Partitioning Support(Stateful Stream)
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
Partitioning Support(Stateful Stream)
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
© 2016 Pivotal Software, Inc. All rights reserved.
Partitioning Support(Stateful Stream)
HTTP
Average
s1.http
Average
{"id":1, "temperature":38}
{"id":2, "temperature":41}
{"id":2, "temperature":42}
{"id":1, "temperature":37}
🤓
© 2016 Pivotal Software, Inc. All rights reserved.
Simple Real Time Analytics
tweets = twitterstream | hdfs
analytics = :ingest.twitterstream > field-value-counter --fieldName=lang
HTTP
s1.http
HDFS COUNTER
Data Flow Server
REST API
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Demo (Twitter Stream!)
© 2016 Pivotal Software, Inc. All rights reserved.
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Task
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Task
• Spring Boot based framework for short lived task
• Spring Boot's CommandLineRunner or Spring Batch
• Result of each process persists in Task Repository
• Well Integrated with Spring Batch (Job Repository)
© 2016 Pivotal Software, Inc. All rights reserved.
Programming Model (CLR)
@SpringBootApplication

@EnableTask
public class DemoTaskApp {

@Bean

CommandLineRunner clr() {

return args -> System.out.println("Task!");

}


public static void main(String[] args) {

SpringApplication.run(DemoTaskApp.class, args);

}

} spring.application.name=hello
© 2016 Pivotal Software, Inc. All rights reserved.
Task Execution List
Task Name ID Start Time End Time Exit Code
hello 3 Tue Nov 15 16:49:08
JST 2016
Tue Nov 15 16:49:08
JST 2016
0
hello 2 Tue Nov 15 16:48:54
JST 2016
Tue Nov 15 16:48:55
JST 2016
0
hello 1 Tue Nov 15 16:48:23
JST 2016
Tue Nov 15 16:48:23
JST 2016
0
© 2016 Pivotal Software, Inc. All rights reserved.
Programming Model (Spring Batch)
@SpringBootApplication @EnableBatchProcessing

@EnableTask
public class DemoBatchApp {
@Autowired JobBuilderFactory jobBuilderFactory;
@Autowired StepBuilderFactory stepBuilderFactory;

@Bean Step step1() { /* ... */ }
@Bean Step step2() { /* ... */ }
@Bean Job job() { return jobBuilderFactory.get("job")
.start(step1()).next(step2()).build()}

public static void main(String[] args) {

SpringApplication.run(DemoTaskApp.class, args);

}}
https://github.com/making/cf-spring-batch-demo
spring.application.name=hello-batch
© 2016 Pivotal Software, Inc. All rights reserved.
Task Execution List
Task Name ID Start Time End Time Exit Code
hello-
batch
5 Tue Nov 15 17:28:49
JST 2016
Tue Nov 15 17:28:49
JST 2016
0
hello-
batch
4 Tue Nov 15 17:27:56
JST 2016
Tue Nov 15 17:27:57
JST 2016
0
© 2016 Pivotal Software, Inc. All rights reserved.
Job Execution List
ID Task ID Start Time Step Execution Count Definition Status
2 5 Tue Nov 15
17:28:49 JST 2016
2 Created
1 4 Tue Nov 15
17:27:56 JST 2016
2 Created
© 2016 Pivotal Software, Inc. All rights reserved.
Step Execution List
ID Step Name Job Exec Id Start Time End Time Status
1 step1 1 Tue Nov 15
17:28:49 JST
2016
Tue Nov 15
17:28:49 JST
2016
COMPLETED
2 step2 1 Tue Nov 15
17:27:56 JST
2016
Tue Nov 15
17:27:57 JST
2016
COMPLETED
© 2016 Pivotal Software, Inc. All rights reserved.
Task Orchestration in SCDF
>task create hello --definition="timestamp --format=¥"yyyy¥""
>task launch hello
timestamp
Data Flow Server DB
Task Name
Start Time
End Time
Exit Code
Exit Message
Last Updated Time
Parameters
Message Broker
© 2016 Pivotal Software, Inc. All rights reserved.
Task Execution List
© 2016 Pivotal Software, Inc. All rights reserved.
Job Execution List
© 2016 Pivotal Software, Inc. All rights reserved.
Job Execution Details
© 2016 Pivotal Software, Inc. All rights reserved.
Spring Cloud Data Flow -> Task
http | tasklaunchrequest --uri=... | task-lancher
timestamp
Data Flow Server DB
Message Broker
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Demo (Scalable Tasks)
© 2016 Pivotal Software, Inc. All rights reserved.
Pivotal Cloud Foundry
PDF PDF
PDF PDF
S3
Spring Cloud Data Flow
Task
Task
Task
Task
PDF
PDF
Spring Cloud Task
Spring Batch
index
index
source sink
‹#›© 2016 Pivotal Software, Inc. All rights reserved.
Getting Started with SCDF
on Cloud Foundry
© 2016 Pivotal Software, Inc. All rights reserved.
Install PCF Dev
• https://docs.pivotal.io/pcf-dev
• Cloud Foundry on your laptop
• Included
• Redis / RabbitMQ / MySQL
• Spring Cloud Services
• Install with cf dev start
© 2016 Pivotal Software, Inc. All rights reserved.
cf create-service p-mysql 512mb df-mysql
cf create-service p-rabbitmq standard df-rebbitmq
cf create-service p-redis shared-vm df-redis
cf push dataflow-server -p spring-cloud-dataflow-
server-cloudfoundry-1.0.1.RELEASE.jar
Deploy SCDF Server on PCF Dev
© 2016 Pivotal Software, Inc. All rights reserved.
Tutorial
• 📗 https://blog.ik.am/entries/396
• 💎 https://github.com/making-demo-scdf/spring-cloud-
dataflow-cookbook
© 2016 Pivotal Software, Inc. All rights reserved.
Upcoming Features
• Some ‘porting’ from XD
• Batch Job DSL + Designer
• Role based access
• Looking forward
• Spring Cloud Sleuth
• JavaDSL
• In-place application version upgrades with Spinnaker
• Application Groups
• Polyglot
• Expanded analytics with Redis and Python/R ecosystem
• More provided apps/tasks
•SCDF Tile for Pivotal Cloud Foundry
© 2016 Pivotal Software, Inc. All rights reserved.
Thanks!
• References
• http://www.slideshare.net/SpringCentral/data-microservices-in-t
cloud ✨
• https://cloud.spring.io/spring-cloud-dataflow/
• http://cloud.spring.io/spring-cloud-stream/
• http://cloud.spring.io/spring-cloud-stream-app-starters/
• https://github.com/spring-cloud/spring-cloud-task/
• http://cloud.spring.io/spring-cloud-dataflow-server-cloudfoundry

More Related Content

PDF
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
PDF
Yahoo! JAPANのコンテンツプラットフォームを支えるSpring Cloud Streamによるマイクロサービスアーキテクチャ #jsug #sf_52
PDF
20190514 AWS Black Belt Online Seminar Amazon API Gateway
PDF
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #cndt2019 #osdt2019 #keynote
PPTX
Qiita Night 足場固めからやるマイクロサービス
PPTX
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
PDF
20200630 AWS Black Belt Online Seminar Amazon Cognito
PDF
[Cloud OnAir] BigQuery の仕組みからベストプラクティスまでのご紹介 2018年9月6日 放送
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
Yahoo! JAPANのコンテンツプラットフォームを支えるSpring Cloud Streamによるマイクロサービスアーキテクチャ #jsug #sf_52
20190514 AWS Black Belt Online Seminar Amazon API Gateway
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #cndt2019 #osdt2019 #keynote
Qiita Night 足場固めからやるマイクロサービス
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
20200630 AWS Black Belt Online Seminar Amazon Cognito
[Cloud OnAir] BigQuery の仕組みからベストプラクティスまでのご紹介 2018年9月6日 放送

What's hot (20)

PPTX
[社内勉強会]ELBとALBと数万スパイク負荷テスト
PPTX
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
PDF
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
PDF
PayPayでのk8s活用事例
PDF
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
PDF
20190129 AWS Black Belt Online Seminar AWS Identity and Access Management (AW...
PDF
AWS Black Belt Online Seminar 2017 Amazon Kinesis
PDF
ここから始めるAWSセキュリティ
PDF
20200722 AWS Black Belt Online Seminar AWSアカウント シングルサインオンの設計と運用
PDF
ヤフー発のメッセージキュー「Pulsar」のご紹介
PDF
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
PDF
20190206 AWS Black Belt Online Seminar Amazon SageMaker Basic Session
PDF
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
PDF
Spring Cloud Data Flow の紹介 #streamctjp
PDF
アプリ開発者、DB 管理者視点での Cloud Spanner 活用方法 | 第 10 回 Google Cloud INSIDE Games & App...
PDF
Infrastructure as Code (IaC) 談義 2022
PDF
20200526 AWS Black Belt Online Seminar AWS X-Ray
PDF
AWS Black Belt Techシリーズ Amazon Kinesis
PDF
Docker道場オンライン#1 Docker基礎概念と用語の理解
PDF
コンテナDojo #4:VSCodeを使ったPodmanコンテナアプリ開発.pdf
[社内勉強会]ELBとALBと数万スパイク負荷テスト
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
PayPayでのk8s活用事例
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
20190129 AWS Black Belt Online Seminar AWS Identity and Access Management (AW...
AWS Black Belt Online Seminar 2017 Amazon Kinesis
ここから始めるAWSセキュリティ
20200722 AWS Black Belt Online Seminar AWSアカウント シングルサインオンの設計と運用
ヤフー発のメッセージキュー「Pulsar」のご紹介
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
20190206 AWS Black Belt Online Seminar Amazon SageMaker Basic Session
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
Spring Cloud Data Flow の紹介 #streamctjp
アプリ開発者、DB 管理者視点での Cloud Spanner 活用方法 | 第 10 回 Google Cloud INSIDE Games & App...
Infrastructure as Code (IaC) 談義 2022
20200526 AWS Black Belt Online Seminar AWS X-Ray
AWS Black Belt Techシリーズ Amazon Kinesis
Docker道場オンライン#1 Docker基礎概念と用語の理解
コンテナDojo #4:VSCodeを使ったPodmanコンテナアプリ開発.pdf
Ad

Viewers also liked (20)

PDF
SpringOne 2GX 2014 参加報告 & Spring 4.1について #jsug
PDF
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
PDF
Spring Day 2016 - Web API アクセス制御の最適解
PDF
Lineにおけるspring frameworkの活用
PDF
Spring Day 2016 springの現在過去未来
PPTX
Spring bootで学ぶ初めてのwebアプリ開発
PPTX
Spring 5に備えるリアクティブプログラミング入門
PPT
Springを使ったwebアプリにリファクタリングしよう
PDF
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
PDF
Grailsでドメイン駆動設計を実践する時の勘所
PPTX
Cloud Foundry x Wagby
PDF
楽天トラベルとSpring(Spring Day 2016)
PDF
ビッグじゃなくても使えるSpark Streaming
PPT
Distributed Tracing Velocity2016
PDF
Distributed tracing - get a grasp on your production
PPTX
Spring CloudとZipkinを利用した分散トレーシング
PDF
形態素解析
PPTX
WalB: Real-time and Incremental Backup System for Block Devices
PDF
3000社の業務データ絞り込みを支える技術
PDF
離れた場所でも最高のチームワークを実現する方法 ーサイボウズ開発チームのリモートワーク事例ー
SpringOne 2GX 2014 参加報告 & Spring 4.1について #jsug
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
Spring Day 2016 - Web API アクセス制御の最適解
Lineにおけるspring frameworkの活用
Spring Day 2016 springの現在過去未来
Spring bootで学ぶ初めてのwebアプリ開発
Spring 5に備えるリアクティブプログラミング入門
Springを使ったwebアプリにリファクタリングしよう
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
Grailsでドメイン駆動設計を実践する時の勘所
Cloud Foundry x Wagby
楽天トラベルとSpring(Spring Day 2016)
ビッグじゃなくても使えるSpark Streaming
Distributed Tracing Velocity2016
Distributed tracing - get a grasp on your production
Spring CloudとZipkinを利用した分散トレーシング
形態素解析
WalB: Real-time and Incremental Backup System for Block Devices
3000社の業務データ絞り込みを支える技術
離れた場所でも最高のチームワークを実現する方法 ーサイボウズ開発チームのリモートワーク事例ー
Ad

Similar to Data Microservices with Spring Cloud Stream, Task, and Data Flow #jsug #springday (20)

PDF
Spring Cloud Servicesの紹介 #pcf_tokyo
PDF
Meetup: Streaming Data Pipeline Development
PDF
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
PDF
2024 February 28 - NYC - Meetup Unlocking Financial Data with Real-Time Pipel...
PDF
Spring Framework 5.0による Reactive Web Application #JavaDayTokyo
PDF
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...
PPTX
Using the SDACK Architecture on Security Event Inspection by Yu-Lun Chen and ...
PDF
Hadoop application architectures - using Customer 360 as an example
PPTX
Real-time Analysis of Data Processing Pipelines with Spring Cloud Data Flow a...
PPTX
Episode 3: Kubernetes and Big Data Services
PDF
Azure HDlnsight에서 R 및 Spark를 이용하여 확장 가능한 머신러닝
PPTX
Big Data Analytics with Spark
PDF
The Heart of the Data Mesh Beats in Real-Time with Apache Kafka
PDF
Data Science at Scale on MPP databases - Use Cases & Open Source Tools
PPTX
Fraud Detection for Israel BigThings Meetup
PDF
DevOps Days Tel Aviv - Serverless Architecture
PPTX
Spark Streaming with Azure Databricks
PDF
Spark Summit EU talk by Christos Erotocritou
PDF
Apache Kafka - Scalable Message-Processing and more !
PDF
Headaches and Breakthroughs in Building Continuous Applications
Spring Cloud Servicesの紹介 #pcf_tokyo
Meetup: Streaming Data Pipeline Development
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
2024 February 28 - NYC - Meetup Unlocking Financial Data with Real-Time Pipel...
Spring Framework 5.0による Reactive Web Application #JavaDayTokyo
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...
Using the SDACK Architecture on Security Event Inspection by Yu-Lun Chen and ...
Hadoop application architectures - using Customer 360 as an example
Real-time Analysis of Data Processing Pipelines with Spring Cloud Data Flow a...
Episode 3: Kubernetes and Big Data Services
Azure HDlnsight에서 R 및 Spark를 이용하여 확장 가능한 머신러닝
Big Data Analytics with Spark
The Heart of the Data Mesh Beats in Real-Time with Apache Kafka
Data Science at Scale on MPP databases - Use Cases & Open Source Tools
Fraud Detection for Israel BigThings Meetup
DevOps Days Tel Aviv - Serverless Architecture
Spark Streaming with Azure Databricks
Spark Summit EU talk by Christos Erotocritou
Apache Kafka - Scalable Message-Processing and more !
Headaches and Breakthroughs in Building Continuous Applications

More from Toshiaki Maki (20)

PDF
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
PDF
Concourse x Spinnaker #concourse_tokyo
PDF
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
PDF
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
PDF
Spring Boot Actuator 2.0 & Micrometer
PDF
Open Service Broker APIとKubernetes Service Catalog #k8sjp
PDF
Spring Cloud Function & Project riff #jsug
PDF
Introduction to Spring WebFlux #jsug #sf_a1
PDF
BOSH / CF Deployment in modern ways #cf_tokyo
PDF
Why PCF is the best platform for Spring Boot
PDF
Zipkin Components #zipkin_jp
PPTX
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
PDF
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
PDF
Spring ❤️ Kotlin #jjug
PDF
Managing your Docker image continuously with Concourse CI
PDF
Short Lived Tasks in Cloud Foundry #cfdtokyo
PDF
今すぐ始めるCloud Foundry #hackt #hackt_k
PDF
Team Support in Concourse CI 2.0 #concourse_tokyo
PDF
From Zero to Hero with REST and OAuth2 #jjug
PDF
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
Concourse x Spinnaker #concourse_tokyo
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer
Open Service Broker APIとKubernetes Service Catalog #k8sjp
Spring Cloud Function & Project riff #jsug
Introduction to Spring WebFlux #jsug #sf_a1
BOSH / CF Deployment in modern ways #cf_tokyo
Why PCF is the best platform for Spring Boot
Zipkin Components #zipkin_jp
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
Spring ❤️ Kotlin #jjug
Managing your Docker image continuously with Concourse CI
Short Lived Tasks in Cloud Foundry #cfdtokyo
今すぐ始めるCloud Foundry #hackt #hackt_k
Team Support in Concourse CI 2.0 #concourse_tokyo
From Zero to Hero with REST and OAuth2 #jjug
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
A comparative analysis of optical character recognition models for extracting...
NewMind AI Weekly Chronicles - August'25-Week II
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Machine Learning_overview_presentation.pptx
Encapsulation_ Review paper, used for researhc scholars
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Diabetes mellitus diagnosis method based random forest with bat algorithm
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Spectroscopy.pptx food analysis technology
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MIND Revenue Release Quarter 2 2025 Press Release
A comparative analysis of optical character recognition models for extracting...

Data Microservices with Spring Cloud Stream, Task, and Data Flow #jsug #springday

  • 1. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Data Microservices with Spring Cloud Stream, Task, and Data Flow Toshiaki Maki (@making) 2016-11-18 Spring Day 2016 #springday #jsug
  • 2. © 2016 Pivotal Software, Inc. All rights reserved. Who am I ? • Toshiaki Maki (@making) http://blog.ik.am • Sr. Solutions Architect @Pivotal • Spring Framework enthusiast bit.ly/hajiboot2
  • 3. © 2016 Pivotal Software, Inc. All rights reserved. Input Motivation HTTP TCP S3 JDBC Rabbit JMS Twitter Syslog Output HDFS Cassandra HAWQ Greenplum JDBC S3 TCP Gemfire ❓❔❓ • Real Time Analysis • Data Ingestion • ETL Process
  • 4. © 2016 Pivotal Software, Inc. All rights reserved. Spring XD (eXtreme Data)
  • 5. © 2016 Pivotal Software, Inc. All rights reserved. Spring XD (eXtreme Data) 🤔
  • 6. © 2016 Pivotal Software, Inc. All rights reserved. Spring XD Architecture Container Container gpfdist Cassandra jms http ZooKeeper Message Broker XD Admin stream1 = http | cassandra stream2 = jms | gpfdist On Metal/VMs
  • 7. © 2016 Pivotal Software, Inc. All rights reserved. Spring XD Architecture Container Container gpfdist Cassandra jms http ZooKeeper Message Broker XD Admin stream1 = http | cassandra stream2 = jms | gpfdist On Metal/VMs 😇
  • 8. © 2016 Pivotal Software, Inc. All rights reserved. Spring XD Architecture Container Container gpfdist Cassandra jms http ZooKeeper Message Broker XD Admin stream1 = http | cassandra stream2 = jms | gpfdist On Metal/VMs
  • 9. © 2016 Pivotal Software, Inc. All rights reserved. Modern Platforms Cloud Foundry YARN Kubernetes Mesos Docker Swarm Nomad OpenShift
  • 10. © 2016 Pivotal Software, Inc. All rights reserved. Cloud Native Redesign •From multiple modules embedded in a container to standalone executable applications •From our own runtime to delegating to existing modern platforms
  • 11. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head
  • 12. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head
  • 13. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head Microservice for each data processing
  • 14. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head Microservice for each data processing
  • 15. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head Microservice for each data processing bound with Message Brokers
  • 16. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head Microservice for each data processing bound with Message Brokers
  • 17. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head Microservice for each data processing bound with Message Brokers on the modern platform
  • 18. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head Microservice for each data processing bound with Message Brokers on the modern platform
  • 19. © 2016 Pivotal Software, Inc. All rights reserved. Data Microservices $ cat book.txt | tr ' ' '¥ ' | tr '[:upper:]' '[:lower:]' | tr -d '[:punct:]' | grep -v '[^a-z]‘ | sort | uniq -c | sort -rn | head Microservice for each data processing bound with Message Brokers on the modern platform
  • 20. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Data Flow • Microservices-based Distributed Data Pipelines •Long Lived Stream Applications •Short Lived Task Applications
  • 21. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Data Flow • Microservices-based Distributed Data Pipelines •Long Lived Stream Applications •Short Lived Task Applications Spring Cloud Stream
  • 22. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Data Flow • Microservices-based Distributed Data Pipelines •Long Lived Stream Applications •Short Lived Task Applications Spring Cloud Stream Spring Cloud Task
  • 23. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Data Flow • Microservices-based Distributed Data Pipelines •Long Lived Stream Applications •Short Lived Task Applications Spring Cloud Stream Spring Cloud Task Orchestration Layer
  • 24. © 2016 Pivotal Software, Inc. All rights reserved. Structure Spring Cloud Data Flow Spring Cloud Deployer (SPI) Spring Cloud Stream Spring Cloud Task Spring Integration Spring Boot Spring Batch
  • 25. © 2016 Pivotal Software, Inc. All rights reserved. Structure Spring Cloud Data Flow Spring Cloud Deployer (SPI) Spring Cloud Stream Spring Cloud Task Spring Integration Spring Boot Spring Batch • Spring Cloud Deployer Local • Spring Cloud Deployer Cloud Foundry • Spring Cloud Deployer Yarn • Spring Cloud Deployer Kubernetes • Spring Cloud Deployer Mesos
  • 26. © 2016 Pivotal Software, Inc. All rights reserved. SCDF Deployment Platform Spring Cloud Data Flow Server Deployer SPI REST API SCDFShell SCDF Flo
  • 27. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Data Flow Architecture gpfdist cassandra jms http stream1 = http | cassandra stream2 = jms | gpfdist Message Broker Data Flow Server DB Platform Runtime
  • 28. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Data Flow Architecture gpfdist cassandra jms http stream1 = http | cassandra stream2 = jms | gpfdist Message Broker Data Flow Server DB Platform Runtime
  • 29. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Stream
  • 30. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Stream • Event-driven microservice framework • Built on battle-tested components (Spring Boot / Spring Integration) • Opinionated primitives for streaming applications • Persistent Pub/Sub • Consumer Groups • Partitioning Support • Pluggable messaging middleware bindings source | processor | sink
  • 31. © 2016 Pivotal Software, Inc. All rights reserved. JJUG CCC in 2 weeks
  • 32. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Stream Applications Twitter Stream Cassandra java -jar twittersource.jar --server.port=8080 --consumerKey=XYZ --consumerSecret=ABC --spring.cloud.stream.bindings. output.destination=ingest Source Sink java -jar cassandrasink.jar --server.port=8081 --spring.cassandra.keyspace=tweet --spring.cloud.stream.bindings. input.destination=ingest
  • 33. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Stream Applications Twitter Stream Cassandra java -jar twittersource.jar --server.port=8080 --consumerKey=XYZ --consumerSecret=ABC --spring.cloud.stream.bindings. output.destination=ingest Source Sink java -jar cassandrasink.jar --server.port=8081 --spring.cassandra.keyspace=tweet --spring.cloud.stream.bindings. input.destination=ingest Twitter Stream Cassandraingest
  • 34. © 2016 Pivotal Software, Inc. All rights reserved. Message Binders • @EnableBinding • Binder Implementations • Production-Ready • Rabbit MQ • Apache Kafka • Experimental • JMS • Google PubSub
  • 35. © 2016 Pivotal Software, Inc. All rights reserved. Programming Model (Sink) @SpringBootApplication
 @EnableBinding(Sink.class)
 public class DemoSinkApp { @StreamListener(Sink.INPUT)
 void receive(Message<String> message) {
 System.out.println("Received " + message);
 }
 public static void main(String[] args) {
 SpringApplication.run(DemoSinkApp.class, args);
 }
 }
  • 36. © 2016 Pivotal Software, Inc. All rights reserved. Sink Properties (Sink) spring.cloud.stream.bindings.input.destination=demo-strm demo- strm input
  • 37. © 2016 Pivotal Software, Inc. All rights reserved. Programming Model (Source) @SpringBootApplication @RestController @EnableBinding(Source.class)
 public class DemoSourceApp {
 @Autowired Source source; @GetMapping void send(@RequestParam String text) {
 source.output() .send(MessageBuilder.withPayload(text).build());
 }
 public static void main(String[] args) {
 SpringApplication.run(DemoSourceApp.class, args);
 }
 }
  • 38. © 2016 Pivotal Software, Inc. All rights reserved. Programming Model (Source) @SpringBootApplication @RestController @EnableBinding(Source.class)
 public class DemoSourceApp { @Bean @InboundChannelAdapter(channel = Source.OUTPUT, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1")) MessageSource<String> source() {
 return () -> MessageBuilder.withPayload("Hi").build());
 }
 public static void main(String[] args) {
 SpringApplication.run(DemoSourceApp.class, args);
 }}
  • 39. © 2016 Pivotal Software, Inc. All rights reserved. Properties (Source) spring.cloud.stream.bindings.output.destination=demo-strm demo- strm Source output
  • 40. © 2016 Pivotal Software, Inc. All rights reserved. Binder (RabbitMQ) <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-stream-rabbit</artifactId> </dependency> demo- strm
  • 41. © 2016 Pivotal Software, Inc. All rights reserved. Binder (Apache Kafka) <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-stream-kafka</artifactId> </dependency> demo- strm
  • 42. © 2016 Pivotal Software, Inc. All rights reserved. Sink Pipeline demo- strm input Source output source | sink
  • 43. © 2016 Pivotal Software, Inc. All rights reserved. Programming Model (Processor) @SpringBootApplication
 @EnableBinding(Processor.class)
 public class DemoProcessorApp { @StreamListener(Processor.INPUT) @SendTo(Processor.OUTPUT)
 void receive(String text) {
 return "[[" + text + "]]";
 }
 public static void main(String[] args) {
 SpringApplication.run(DemoProcessorApp.class, args);
 }
 }
  • 44. © 2016 Pivotal Software, Inc. All rights reserved. Properties (Processor) spring.cloud.stream.bindings.output.destination=my-source spring.cloud.stream.bindings.input.destination=my-source spring.cloud.stream.bindings.output.destination=my-proc spring.cloud.stream.bindings.input.destination=my-proc Source Processor Sink
  • 45. © 2016 Pivotal Software, Inc. All rights reserved. Pipeline my- source Source output source | processor | sink Processor output input my-proc Sink input
  • 46. © 2016 Pivotal Software, Inc. All rights reserved. Reactive API Support @SpringBootApplication
 @EnableBinding(Processor.class)
 public class DemoProcessorRxApp { @StreamListener @Output(Processor.OUTPUT)
 public Flux<String> receive(@Input(Processor.INPUT) Flux<String> stream) {
 return stream.map(text -> "[[" + text + "]]");
 }
 public static void main(String[] args) {
 SpringApplication.run(DemoProcessorRxApp.class, args);
 }
 }
  • 47. © 2016 Pivotal Software, Inc. All rights reserved. Reactive API Support @StreamListener @Output(Processor.OUTPUT)
 public Flux<AverageData> receive(@Input(Processor.INPUT) Flux<SensorData> stream) {
 return stream.window(Duration.ofSecond(20), Duration.ofSecond(10)) .flatMap(win -> win.groupBy(sensor -> sensor.id)) .flatMap(group -> calcAverage(group));
 }
  • 48. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Stream App Starters Source Processor Sink file ftp gemfire gemfire-cq http jdbc jms load-generator loggregator mail mongodb rabbit s3 sftp syslog tcp tcp-client time trigger triggertask twitterstream bridge filter groovy-filter groovy- transform httpclient pommel scriptable- transform splitter tcp-client transform aggregate- counter cassandra counter field-value- counter file ftp gemfire gpfdist hfs hdfs-dataset jdbc log rabbit redis-pubsub router s3 sftp task-launcher- local task-lancher- yarn tcp throughput web socket http://cloud.spring.io/spring-cloud-stream-app-starters/
  • 49. © 2016 Pivotal Software, Inc. All rights reserved. Stream Orchestration in SCDF ingest = twitterstream | cassandra dataflow:> stream create --name=ingest --definition="twitterstream | cassandra" dataflow:> stream deploy --name=ingest |
  • 50. © 2016 Pivotal Software, Inc. All rights reserved. Import apps dataflow:> app import --uri http://bit.ly/1-0-4- GA-stream-applications-rabbit-maven rabbit maven kafka docker stream-applications- http://cloud.spring.io/spring-cloud-stream-app-starters/
  • 51. © 2016 Pivotal Software, Inc. All rights reserved. Register your own apps dataflow:> app register --name foo --type source --uri http://example.com/foo-source-1.0.jar dataflow:> app register --name foo --type source --uri maven://com.example:foo-source:1.0 dataflow:> app register --name foo --type source --uri docker:myapps/foo-source:1.0 dataflow:> app register --name foo --type source --uri file:///tmp/foo-source:1.0
  • 52. © 2016 Pivotal Software, Inc. All rights reserved. Instance Count dataflow:> stream create --name=s1 --definition="http | work | hdfs" dataflow:> stream deploy --name=s1 -- properties="app.http.count=2,app.work.count=3,app .hdfs.count=4"
  • 53. © 2016 Pivotal Software, Inc. All rights reserved. Instance Count http work hdfs http work work hdfs hdfs hdfs LoadBalancer
  • 54. © 2016 Pivotal Software, Inc. All rights reserved. Resource Management dataflow:> stream deploy --name=s1 -- properties="app.work.spring.cloud.deployer.cloudf oundry.memory=2048"
  • 55. © 2016 Pivotal Software, Inc. All rights reserved. Resource Management http http work work work hdfs hdfs hdfs hdfs
  • 56. © 2016 Pivotal Software, Inc. All rights reserved. Spring Flo http://projects.spring.io/spring-flo/
  • 57. © 2016 Pivotal Software, Inc. All rights reserved. Stream Core Features •Persistent Pub-Sub •Consumer Group •Partitioning Support
  • 58. © 2016 Pivotal Software, Inc. All rights reserved. Persistent Pub-Sub HTTP Average Top Ns1.http s1.ave Message Broker
  • 59. © 2016 Pivotal Software, Inc. All rights reserved. Persistent Pub-Sub HTTP Average HDFS Top Ns1.http s1.ave Message Broker
  • 60. © 2016 Pivotal Software, Inc. All rights reserved. Persistent Pub-Sub HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker
  • 61. © 2016 Pivotal Software, Inc. All rights reserved. Persistent Pub-Sub HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38}
  • 62. © 2016 Pivotal Software, Inc. All rights reserved. Persistent Pub-Sub HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38}{"id":1, "temperature":38}
  • 63. © 2016 Pivotal Software, Inc. All rights reserved. Persistent Pub-Sub HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38}
  • 64. © 2016 Pivotal Software, Inc. All rights reserved. Persistent Pub-Sub HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature": {"id":1, "temperature":38} {"id":1, "temperature":38}
  • 65. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker Average Average HDFS HDFS
  • 66. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38} Average Average HDFS HDFS
  • 67. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38}{"id":1, "temperature":38} Average Average HDFS HDFS
  • 68. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38} {"id":1, "temperature":38} Average Average HDFS HDFS {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38}
  • 69. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38} {"id":1, "temperature":38} Average Average HDFS HDFS {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38} 😩
  • 70. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38} {"id":1, "temperature":38} Average Average HDFS HDFS {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38} 😩 Consumer Group
  • 71. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker {"id":1, "temperature":38} {"id":1, "temperature":38} Average Average HDFS HDFS {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38} {"id":1, "temperature":38} 😩 spring.cloud.stream.bindings.<channelName>.group=ave Spring Cloud Stream group is configured by default 😁 Spring Cloud Data Flow Consumer Group
  • 72. © 2016 Pivotal Software, Inc. All rights reserved. Consumer Group HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker Average Average HDFS HDFS group=ave group=hdfs
  • 73. © 2016 Pivotal Software, Inc. All rights reserved. Consumer Group HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker Average Average HDFS HDFS group=ave group=hdfs {"id":1, "temperature":38}
  • 74. © 2016 Pivotal Software, Inc. All rights reserved. Consumer Group HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker Average Average HDFS HDFS group=ave group=hdfs {"id":1, "temperature":38}{"id":1, "temperature":38}
  • 75. © 2016 Pivotal Software, Inc. All rights reserved. Consumer Group HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker Average Average HDFS HDFS group=ave group=hdfs {"id":1, "temperature":38} {"id":1, "temperature":38}
  • 76. © 2016 Pivotal Software, Inc. All rights reserved. Consumer Group HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker Average Average HDFS HDFS group=ave group=hdfs {"id":1, "temperature":38} {"id":1, "temperature":38} 🤓
  • 77. © 2016 Pivotal Software, Inc. All rights reserved. Consumer Group HTTP Average HDFS Top N Fault Detection s1.http s1.ave Message Broker Average Average HDFS HDFS group=ave group=hdfs {"id":1, "temperature":38} {"id":1, "temperature":38} 🤓consumer group subscriptions are durable 😁
  • 78. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average
  • 79. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 80. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 81. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 82. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 83. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 84. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37} 😩
  • 85. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37} 😩 Partitioning Support(Stateful Stream)
  • 86. © 2016 Pivotal Software, Inc. All rights reserved. HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37} 😩stream deploy --name=xxxx --properties= "app.http.producer.partitionKeyExpression=payload.id" spring.cloud.stream.bindings.<channelName>.producer.par titionKeyExpression=payload.id Spring Cloud Stream Spring Cloud Data Flow Partitioning Support(Stateful Stream)
  • 87. © 2016 Pivotal Software, Inc. All rights reserved. Partitioning Support(Stateful Stream) HTTP Average s1.http Average
  • 88. © 2016 Pivotal Software, Inc. All rights reserved. Partitioning Support(Stateful Stream) HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 89. © 2016 Pivotal Software, Inc. All rights reserved. Partitioning Support(Stateful Stream) HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 90. © 2016 Pivotal Software, Inc. All rights reserved. Partitioning Support(Stateful Stream) HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 91. © 2016 Pivotal Software, Inc. All rights reserved. Partitioning Support(Stateful Stream) HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 92. © 2016 Pivotal Software, Inc. All rights reserved. Partitioning Support(Stateful Stream) HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37}
  • 93. © 2016 Pivotal Software, Inc. All rights reserved. Partitioning Support(Stateful Stream) HTTP Average s1.http Average {"id":1, "temperature":38} {"id":2, "temperature":41} {"id":2, "temperature":42} {"id":1, "temperature":37} 🤓
  • 94. © 2016 Pivotal Software, Inc. All rights reserved. Simple Real Time Analytics tweets = twitterstream | hdfs analytics = :ingest.twitterstream > field-value-counter --fieldName=lang HTTP s1.http HDFS COUNTER Data Flow Server REST API
  • 95. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Demo (Twitter Stream!)
  • 96. © 2016 Pivotal Software, Inc. All rights reserved.
  • 97. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Task
  • 98. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Task • Spring Boot based framework for short lived task • Spring Boot's CommandLineRunner or Spring Batch • Result of each process persists in Task Repository • Well Integrated with Spring Batch (Job Repository)
  • 99. © 2016 Pivotal Software, Inc. All rights reserved. Programming Model (CLR) @SpringBootApplication
 @EnableTask public class DemoTaskApp {
 @Bean
 CommandLineRunner clr() {
 return args -> System.out.println("Task!");
 } 
 public static void main(String[] args) {
 SpringApplication.run(DemoTaskApp.class, args);
 }
 } spring.application.name=hello
  • 100. © 2016 Pivotal Software, Inc. All rights reserved. Task Execution List Task Name ID Start Time End Time Exit Code hello 3 Tue Nov 15 16:49:08 JST 2016 Tue Nov 15 16:49:08 JST 2016 0 hello 2 Tue Nov 15 16:48:54 JST 2016 Tue Nov 15 16:48:55 JST 2016 0 hello 1 Tue Nov 15 16:48:23 JST 2016 Tue Nov 15 16:48:23 JST 2016 0
  • 101. © 2016 Pivotal Software, Inc. All rights reserved. Programming Model (Spring Batch) @SpringBootApplication @EnableBatchProcessing
 @EnableTask public class DemoBatchApp { @Autowired JobBuilderFactory jobBuilderFactory; @Autowired StepBuilderFactory stepBuilderFactory;
 @Bean Step step1() { /* ... */ } @Bean Step step2() { /* ... */ } @Bean Job job() { return jobBuilderFactory.get("job") .start(step1()).next(step2()).build()}
 public static void main(String[] args) {
 SpringApplication.run(DemoTaskApp.class, args);
 }} https://github.com/making/cf-spring-batch-demo spring.application.name=hello-batch
  • 102. © 2016 Pivotal Software, Inc. All rights reserved. Task Execution List Task Name ID Start Time End Time Exit Code hello- batch 5 Tue Nov 15 17:28:49 JST 2016 Tue Nov 15 17:28:49 JST 2016 0 hello- batch 4 Tue Nov 15 17:27:56 JST 2016 Tue Nov 15 17:27:57 JST 2016 0
  • 103. © 2016 Pivotal Software, Inc. All rights reserved. Job Execution List ID Task ID Start Time Step Execution Count Definition Status 2 5 Tue Nov 15 17:28:49 JST 2016 2 Created 1 4 Tue Nov 15 17:27:56 JST 2016 2 Created
  • 104. © 2016 Pivotal Software, Inc. All rights reserved. Step Execution List ID Step Name Job Exec Id Start Time End Time Status 1 step1 1 Tue Nov 15 17:28:49 JST 2016 Tue Nov 15 17:28:49 JST 2016 COMPLETED 2 step2 1 Tue Nov 15 17:27:56 JST 2016 Tue Nov 15 17:27:57 JST 2016 COMPLETED
  • 105. © 2016 Pivotal Software, Inc. All rights reserved. Task Orchestration in SCDF >task create hello --definition="timestamp --format=¥"yyyy¥"" >task launch hello timestamp Data Flow Server DB Task Name Start Time End Time Exit Code Exit Message Last Updated Time Parameters Message Broker
  • 106. © 2016 Pivotal Software, Inc. All rights reserved. Task Execution List
  • 107. © 2016 Pivotal Software, Inc. All rights reserved. Job Execution List
  • 108. © 2016 Pivotal Software, Inc. All rights reserved. Job Execution Details
  • 109. © 2016 Pivotal Software, Inc. All rights reserved. Spring Cloud Data Flow -> Task http | tasklaunchrequest --uri=... | task-lancher timestamp Data Flow Server DB Message Broker
  • 110. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Demo (Scalable Tasks)
  • 111. © 2016 Pivotal Software, Inc. All rights reserved. Pivotal Cloud Foundry PDF PDF PDF PDF S3 Spring Cloud Data Flow Task Task Task Task PDF PDF Spring Cloud Task Spring Batch index index source sink
  • 112. ‹#›© 2016 Pivotal Software, Inc. All rights reserved. Getting Started with SCDF on Cloud Foundry
  • 113. © 2016 Pivotal Software, Inc. All rights reserved. Install PCF Dev • https://docs.pivotal.io/pcf-dev • Cloud Foundry on your laptop • Included • Redis / RabbitMQ / MySQL • Spring Cloud Services • Install with cf dev start
  • 114. © 2016 Pivotal Software, Inc. All rights reserved. cf create-service p-mysql 512mb df-mysql cf create-service p-rabbitmq standard df-rebbitmq cf create-service p-redis shared-vm df-redis cf push dataflow-server -p spring-cloud-dataflow- server-cloudfoundry-1.0.1.RELEASE.jar Deploy SCDF Server on PCF Dev
  • 115. © 2016 Pivotal Software, Inc. All rights reserved. Tutorial • 📗 https://blog.ik.am/entries/396 • 💎 https://github.com/making-demo-scdf/spring-cloud- dataflow-cookbook
  • 116. © 2016 Pivotal Software, Inc. All rights reserved. Upcoming Features • Some ‘porting’ from XD • Batch Job DSL + Designer • Role based access • Looking forward • Spring Cloud Sleuth • JavaDSL • In-place application version upgrades with Spinnaker • Application Groups • Polyglot • Expanded analytics with Redis and Python/R ecosystem • More provided apps/tasks •SCDF Tile for Pivotal Cloud Foundry
  • 117. © 2016 Pivotal Software, Inc. All rights reserved. Thanks! • References • http://www.slideshare.net/SpringCentral/data-microservices-in-t cloud ✨ • https://cloud.spring.io/spring-cloud-dataflow/ • http://cloud.spring.io/spring-cloud-stream/ • http://cloud.spring.io/spring-cloud-stream-app-starters/ • https://github.com/spring-cloud/spring-cloud-task/ • http://cloud.spring.io/spring-cloud-dataflow-server-cloudfoundry