Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Data Streaming für Cloud Natives

Data Streaming für Cloud Natives

Avatar for Nicolas Byl

Nicolas Byl

May 04, 2017
Tweet

More Decks by Nicolas Byl

Other Decks in Technology

Transcript

  1. 3 . 3 Stream Struktur Source als Datenquelle Multiple Processor

    Instanzen für nachfolgende Verarbeitungsschritte Sink als Ende der Verarbeitungskette
  2. 3 . 4 3 . 5 Verarbeitung Jeder Instanz der

    Verarbeitungskette ist eine Spring Boot Applikation Pufferung zwischen Verarbeitungsschritten in Queue Pull Mechanismus für nächste Datensatz
  3. 4 . 2 4 . 3 Building Blocks Spring Boot

    Spring Integration Spring Batch
  4. 4 . 4 Deployables Spring Boot Applikationen Spring Cloud Stream

    Starters Spring Cloud Stream Spring Cloud Task
  5. 5 . 2 Command Line Interface Definition und Management der

    vorhandenen Streams DSL zur Verkettung von Applikation mittels |
  6. 5 . 4 Beispiel 2: HTTP-Request stream create --name test

    --definition "http | log" stream deploy test --properties "app.http.spring.cloud.deployer.kubernetes.c http post --target http://<IP>:8080 --data "Hello"
  7. 6 . 2 Programmiermodell - Spring Cloud Stream Source, Sink

    & Processor sind normale Spring Beans Kopplung an Spring Integration Binding an den jeweiligen Typen Abstraktion des Queueing Providers durch das Framework
  8. 6 . 3 Beispiel 1: Direkte Bearbeitung in der Beans

    @EnableBinding(Processor.class) public class TransformProcessor { @Autowired VotingService votingService; @StreamListener(Processor.INPUT) @SendTo(Processor.OUTPUT) public VoteResult handle(Vote vote) { return votingService.record(vote); } }
  9. 6 . 4 Beispiel 2: Spring Integration als Source @EnableBinding(Source.class)

    public class TimerSource { @Value("${format}") private String format; @Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay public MessageSource<String> timerMessageSource() { return () -> new GenericMessage<>(new SimpleDateFormat(format).format( } }
  10. 6 . 5 Beispiel 3: Reative Processor @EnableRxJavaProcessor public class

    RxJavaTransformer { private static Logger logger = LoggerFactory.getLogger(RxJavaTransformer @Bean public RxJavaProcessor<String,String> processor() { return inputStream -> inputStream.map(data -> { logger.info("Got data = " + data); return data; }) .buffer(5) .map(data -> String.valueOf(avg(data))); } [...] }
  11. 7 . 2 Beispiel 3: Twitter Analyse stream create --name

    twitter-demo --definition "twitterstream --twitter.credentials.consumer-key=<...> [..] | field-value-counter --field-value-counter.fieldName=entities.hashtags.text --field-value-counter.name=hashtags"