Java Magazine, January/February 2018

Total Page:16

File Type:pdf, Size:1020Kb

Java Magazine, January/February 2018 INTERFACES IN DEPTH 90 | BOOKS ON JAVA 9 07 JANUARY/FEBRUARY 2018 magazine REACTIVE By and for the Java community PROGRAMMING Handling large data streams efciently 16 32 61 69 REACTIVE RXJAVA— REACTORS IN CQRS: NOT PROGRAMMING REACTIVE SPRING 5.0 THE USUAL WITH JAX-RS LIBRARY FOR CRUD THE JVM ORACLE.COM/JAVAMAGAZINE //table of contents / COVER FEATURES 32 61 69 GOING REACTIVE REACTIVE SPRING COMMAND QUERY WITH ECLIPSE VERT.X By Josh Long RESPONSIBILITY AND RXJAVA Proceeding from fundamentals, SEGREGATION By Clement Escoffier use the Spring Framework WITH JAVA and Julien Ponge to quickly build a reactive By Sebastian Daschner Building fast scalable systems application. Get around the limitations of with one of the most popular CRUD by using event streams reactive Java libraries and an eventually consistent 16 architecture. REACTIVE PROGRAMMING WITH JAX-RS By Mert Çalışkan Using an asynchronous approach and staging to develop responsive reactive apps OTHER FEATURES DEPARTMENTS 90 101 05 13 The Evolving Nature Fix This From the Editor User Groups of Java Interfaces By Simon Roberts and Mikalai Zaikin The decline of dynamic typing The Denver JUG By Michael Kölling Our latest quiz with questions that 07 114 Understanding multiple inheritance test intermediate and advanced Java Books Contact Us in Java knowledge of the language Reviews of Java 9 Modularity and Have a comment? Suggestion? Want to Java 9 for Programmers submit an article proposal? Here’s how. 10 Events Upcoming Java conferences and events COVER ART BY PEDRO MURTEIRA 02 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2018 EDITORIAL PUBLISHING Editor in Chief Publisher and Audience Development Andrew Binstock Director Managing Editor Karin Kinnear Claire Breen Audience Development Manager Copy Editors Jennifer Kurtz Karen Perkins, Leslie Steere Technical Reviewer ADVERTISING SALES Stephen Chin Sales Director Tom Cometa DESIGN Account Manager Senior Creative Director Mark Makinney Francisco G Delgadillo Mailing-List Rentals Design Director Contact your sales representative. Richard Merchán Senior Designer RESOURCES Arianna Pucherelli Oracle Products Designer +1.800.367.8674 (US/Canada) Jaime Ferrand Oracle Services Senior Publication Designer +1.888.283.0591 (US) Sheila Brennan Production Designer Kathy Cygnarowicz ARTICLE SUBMISSION If you are interested in submitting an article, please email the editors. SUBSCRIPTION INFORMATION Subscriptions are complimentary for qualified individuals who complete the subscription form. You’ve Earned It MAGAZINE CUSTOMER SERVICE [email protected] Display Your Oracle Certification Digital Badge PRIVACY Oracle Publishing allows sharing of its mailing list with selected third parties. If you prefer that your mailing address or email address not be included in this program, contact Customer Service. Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. No part of this publication may be reprinted or otherwise reproduced without permission from the editors. JAVA MAGAZINE IS PROVIDED ON AN “AS IS” BASIS. ORACLE EXPRESSLY DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY DAMAGES OF ANY KIND ARISING FROM YOUR USE OF OR RELIANCE ON ANY INFORMATION PROVIDED HEREIN. Opinions ASSOCIATE PROFESSIONAL MASTER EXPERT SPECIALIST expressed by authors, editors, and interviewees—even if they are Oracle employees—do not necessarily reflect the views of Oracle. The information is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Oracle and Java are registered trademarks of Oracle Corporation and/or its Claim your certification badge and validate affiliates. Other names may be trademarks of their respective owners. your skills across all online platforms. Java Magazine is published bimonthly and made available at no cost to qualified subscribers by Oracle, 500 Oracle Parkway, MS OPL-3A, Redwood City, CA 94065-1600. 03 ORACLE.COM/JAVAMAGAZINE ///////////////////////////////// JANUARY/FEBRUARY 2018 Register Now Oracle Code is BACK! | 1-Day, Free Event Explore the Latest Developer Trends: • DevOps, Containers, Microservices, and APIs • MySQL, NoSQL, Oracle, and Open Source Databases • Development Tools and Low Code Platforms • Open Source Technologies • Machine Learning, AI, and Chatbots Coming to a city near you: developer.oracle.com/code //from the editor / Java in the Cloud The Decline of Dynamic Typing Oracle Cloud delivers A feature once viewed as a convenience has become more troublesome than it’s worth. high-performance and battle-tested platform and infrastructure services for the most demanding f you follow the rise and fall of programming As a quick refresher, static typing refers to a Java apps. Ilanguages—either from the comfort of an type system that makes it possible to know the armchair, ensconced with your preferred tools type of every data item and expression at compile but interested in other people’s choices, or from time. Specifically, this means that the language Oracle Cloud. a keyboard, happy to hyperkinetically try out all does not allow the use of types that are resolved Built for modern app dev. kinds of new idioms—you will have noticed an at runtime. For example, in JavaScript (a dynami- Built for you. unmistakable trend in modern language design: cally typed language) a variable is declared by a preference for static typing. using var, rather than a specific type. A variable Look at the major languages that have can hold a string, a number, or a boolean at vari- emerged in the past decade—Go, Swift, Kotlin, ous times in the same program. In contrast, static and Rust—they’re all statically typed. Moreover, types, such as those found in Java, force you to languages that were once dynamic have added declare the type when you define the variable. static typing. The most conspicuous example is Static typing provides several important the recent set of updates to JavaScript (or more advantages. The first advantage is that the com- Start here: accurately, ECMAScript). Apple’s choice to replace piler can perform significant program verifi- developer.oracle.com dynamically typed Objective-C with Swift also cation. Because the compiler knows that i, for follows this trend. example, has been declared an integer, it can #developersrule PHOTOGRAPH BY BOB ADLER/THE VERBATIM AGENCY 05 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2018 //from the editor / check that all places where i is this aspect is invaluable. Stepping quick and easy development, was used do expect or at least can through code in which the con- a welcome step forward. support an integer. Likewise, tents of a variable can change But while dynamic languages static source code checkers are type is not anybody’s idea of fun. have retained considerable popu- much more capable when they The dynamic aspect also intro- larity, some 15 years later the have complete type information. duces a kind of uncertainty when cost of dynamic typing is more A second key benefit is per- a bug is discovered. Say the vari- apparent as codebases grow formance. A runtime that must able i, which previously held an larger, performance becomes The Best determine the type of every vari- integer, now holds a string; was more important, and the cost able and the methods that are that a spelling error by the devel- of maintenance rises steadily. Resource available to it while the program oper, who meant to store it in u, While those dynamically typed is running has significant over- or was it an intentional reuse languages will surely be with for Modern head that statically typed lan- of a variable? And if the latter, us for a long time, it is unlikely guages don’t require. In part, this how should you understand that many new languages will Cloud Dev is why many of the traditional other instances of i in the code- embrace the model. dynamic languages—Python, base? These problems are bear- The Oracle Developer Perl, and Ruby—run much more able in the small but extremely Andrew Binstock, Editor in Chief Gateway is the best place slowly than statically typed troublesome in the large. This [email protected] to jump-start your modern options. An exception to this problem—precisely as it appears @platypusguy cloud development skills might be JavaScript, which runs in large projects—was the pri- with free trials, downloads, much faster than many dynamic mary motivation for Microsoft to tutorials, documentation, languages. But this speed is a create TypeScript, its superset of and more. comparatively recent advance JavaScript that added one princi- driven by massive investments by pal feature: types. Trials. Downloads. Google and Microsoft into their Dynamic typing flourished Tutorials. Start here: respective JavaScript engines. in popular languages in the mid- developer.oracle.com A final benefit, which in my 1990s (Python, Ruby, JavaScript, view is the one that has turned and PHP all appeared within the tide against dynamic lan- a four-year window), when PC guages, is maintainability. First, hardware had become power- for readability, it is much easier ful enough to run languages developer.oracle.com to understand code if types are that needed runtime support. At declared statically because it is the time, tools were primitive then possible to tell exactly what and compile times were long, so #developersrule you’re looking at. For debugging, dynamic typing, which facilitated 06 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2018 // java books / Java 9 Books The wave of books for the new release is now arriving. s with all previous major releases, the arrival of Java 9 has unleashed a wave of books examining and A explaining its new features. The next few book columns will review important titles that you’ll want to be aware of.
Recommended publications
  • Reactive Programming with Scala, Lagom, Spark, Akka and Play
    Issue October 2016 | presented by www.jaxenter.com #53 The digital magazine for enterprise developers Reactive Programming with Scala, Lagom, Spark, Akka and Play Interview with Scala creator Martin Odersky The state of Scala The Lagom Framework Lagom gives the developer a clear path DevOpsCon 2016: Our mission statement This is how we interpret modern DevOps ©istockphoto.com/moorsky Editorial Reactive programming is gaining momentum “We believe that a coherent approach to systems architec- If the definition “stream of events” does not satisfy your ture is needed, and we believe that all necessary aspects are thirst for knowledge, get ready to find out what reactive pro- already recognized individually: we want systems that are Re- gramming means to our experts in Scala, Lagom, Spark, Akka sponsive, Resilient, Elastic and Message Driven. We call these and Play. Plus, we talked to Scala creator Martin Odersky Reactive Systems.” – The Reactive Manifesto about the impending Scala 2.12, the current state of this pro- Why should anyone adopt reactive programming? Because gramming language and the technical innovations that await it allows you to make code more concise and focus on im- us. portant aspects such as the interdependence of events which Thirsty for more? Open the magazine and see what we have describe the business logic. Reactive programming means dif- prepared for you. ferent things to different people and we are not trying to rein- vent the wheel or define this concept. Instead we are allowing Gabriela Motroc, Editor our authors to prove how Scala, Lagom, Spark, Akka and Play co-exist and work together to create a reactive universe.
    [Show full text]
  • Comparing Reactive and Conventional Programming of Java Based Microservices in Containerised Environments
    Master thesis Philip Dakowitz Comparing reactive and conventional programming of Java based microservices in containerised environments Fakultät Technik und Informatik Faculty of Engineering and Computer Science Studiendepartment Informatik Department of Computer Science Philip Dakowitz Comparing reactive and conventional programming of Java based microservices in containerised environments Master thesis eingereicht im Rahmen der Masterprüfung im Studiengang Master of Science Informatik am Department Informatik der Fakultät Technik und Informatik der Hochschule für Angewandte Wissenschaften Hamburg Betreuer: Prof. Dr. Stefan Sarstedt Betreuer: Prof. Dr. Olaf Zukunft Eingereicht am: 27. März 2018 Philip Dakowitz Thema der Arbeit Vergleich von reaktiver und konventioneller Programmierung Java-basierter Microser- vices in containerisierten Umgebungen Stichworte Reaktive Systeme, Reaktive Programmierung, Microservices, Softwarearchitektur, Java, Containervirtualisierung, Docker, Kubernetes, Softwareentwicklung, Lasttests Kurzzusammenfassung Dieses Dokument beschreibt den Vergleich von reaktiver und konventioneller Program- mierung anhand eines in Java entwickelten Beispielprojekts mit dem Ziel herauszufinden, ob eine der beiden Varianten Vor- oder Nachteile gegenüber der anderen hat. Es wurden automatisierte Last- und Widerstandsfähigkeitstests auf beiden Systemen durchgeführt und zusammen mit systeminternen Metriken aufgezeichnet. Es hat sich gezeigt, dass re- aktive Programmierung in diesem Szenario keine besseren Ergebnisse bei den Lasttests
    [Show full text]
  • Building Kafka-Based Microservices with Akka Streams and Kafka Streams
    Building Kafka-based Microservices with Akka Streams and Kafka Streams Boris Lublinsky and Dean Wampler, Lightbend [email protected] [email protected] ©Copyright 2018, Lightbend, Inc. Apache 2.0 License. Please use as you see fit, but attribution is requested. • Overview of streaming architectures • Kafka, Spark, Flink, Akka Streams, Kafka Streams • Running example: Serving machine learning models • Streaming in a microservice context • Outline Akka Streams • Kafka Streams • Wrap up About Streaming Architectures Why Kafka, Spark, Flink, Akka Streams, and Kafka Streams? Check out these resources: Dean’s book Webinars etc. Fast Data Architectures for Streaming Applications Getting Answers Now from Data Sets that Never End By Dean Wampler, Ph. D., VP of Fast Data Engineering Get Your Free Copy 4 ! Dean wrote this report describing the whole fast data landscape. ! bit.ly/lightbend-fast-data ! Previous talks (“Stream All the Things!”) and webinars (such as this one, https://info.lightbend.com/webinar-moving-from-big-data-to-fast-data-heres-how-to-pick-the- right-streaming-engine-recording.html) have covered the whole architecture. This session dives into the next level of detail, using Akka Streams and Kafka Streams to build Kafka-based microservices Today’s focus: Mesos, YARN, Cloud, … 11 •Kafka - the data RP Go 3 NoDe.js … ZK backplane Microservices 4 ZooKeeper Cluster REST 2 •Akka Streams Flink and Kafka 6 Akka Streams Beam Ka9a Streams Sockets Ka9a 7 Streams - 1 … KaEa Cluster Low Latency streaming 5 Logs 8 microservices Spark 9 Streaming Beam S3 DiskDiskDisk Mini-batch HDFS 10 SQL/ Spark Search NoSQL … Persistence Batch Kafka is the data backplane for high-volume data streams, which are organized by topics.
    [Show full text]
  • Spring Cloud Stream Reference Guide
    Spring Cloud Stream Reference Guide Brooklyn.M1 Copyright © 2013-2016Pivotal Software, Inc. Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. Spring Cloud Stream Reference Guide Table of Contents I. Spring Cloud Stream Core ....................................................................................................... 1 1. Introducing Spring Cloud Stream ..................................................................................... 2 2. Main Concepts ................................................................................................................ 4 2.1. Application Model ................................................................................................. 4 Fat JAR .............................................................................................................. 4 2.2. The Binder Abstraction ......................................................................................... 4 2.3. Persistent Publish-Subscribe Support .................................................................... 5 2.4. Consumer Groups ................................................................................................ 5 Durability ............................................................................................................ 5 2.5. Partitioning Support .............................................................................................
    [Show full text]
  • Always On. 2018-10
    From Overnight to Always On Enno Runne Reactive Summit 2018-10-24 Enno Runne • Alpakka Tech Lead @ Lightbend • Stockholm, Sweden File content as streams File-based integration Read Write from file to file Disk Disk Copying a file in traditional Java InputStream is = new BufferedInputStream( new FileInputStream(sourceFilename)); OutputStream os = new BufferedOutputStream( new FileOutputStream(targetFilename)); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } is.close(); os.close(); Let’s call it source and sink Source<Byte…> Sink<Byte…> Read Write from file to file Disk Disk File source and sink with Akka Streams Source<ByteString, …> Sink<ByteString, …> FileIO.fromPath(sourceFile) FileIO.toPath(targetFile) Read Write from file to file Disk Disk Connect source and sink Source<ByteString,…> CompletionStage<IOResult fileSource = FileIO.fromPath(sourceFile); Sink<ByteString,…>CompletionStage<IOResult>>fileSink = FileIO.toPath(targetFile); fileSource .to(fileSink) .run(materializer); Read Write from file to file Materialized values Source<ByteString, CompletionStage<IOResult>> fileSource = FileIO.fromPath(sourceFile); Sink<ByteString, CompletionStage<IOResult>> fileSink = FileIO.toPath(targetFile); CompletionStage<IOResult> handle = fileSource .to(fileSink) .run(materializer); Materialized values Source<ByteString, CompletionStage<IOResult>> fileSource = FileIO.fromPath(sourceFile); Sink<ByteString, CompletionStage<IOResult>> fileSink = FileIO.toPath(targetFile); CompletionStage<IOResult>
    [Show full text]
  • Reactive Web Applications
    Covers Play, Akka, and Reactive Streams Manuel Bernhardt FOREWORD BY James Roper SAMPLE CHAPTER MANNING Reactive Web Applications by Manuel Bernhardt Chapter 2 Copyright 2016 Manning Publications brief contents PART 1GETTING STARTED WITH REACTIVE WEB APPLICATIONS .............1 1 ■ Did you say reactive? 3 2 ■ Your first reactive web application 26 3 ■ Functional programming primer 50 4 ■ Quick introduction to Play 71 PART 2CORE CONCEPTS...........................................................101 5 ■ Futures 103 6 ■ Actors 134 7 ■ Dealing with state 164 8 ■ Responsive user interfaces 201 PART 3ADVANCED TOPICS ........................................................225 9 ■ Reactive Streams 227 10 ■ Deploying reactive Play applications 244 11 ■ Testing reactive web applications 263 v Your first reactive web application This chapter covers ■ Creating a new Play project ■ Streaming data from a remote server and broadcasting it to clients ■ Dealing with failure In the previous chapter, we talked about the key benefits of adopting a reactive approach to web application design and operation, and you saw that the Play Framework is a good technology for this. Now it’s time to get your hands dirty and build a reactive web application. We’ll build a simple application that con­ nects to the Twitter API to retrieve a stream of tweets and send them to clients using WebSockets. 2.1 Creating and running a new project An easy way to start a new Play project is to use the Lightbend Activator, which is a thin wrapper around Scala’s sbt build tool that provides templates for creating new projects. The following instructions assume that you have the Activator 26 Creating and running a new project 27 installed on your computer.
    [Show full text]
  • Spring Boot Reference Documentation
    Spring Boot Reference Documentation Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch, Andy Wilkinson, Marcel Overdijk, Christian Dupuis, Sébastien Deleuze, Michael Simons, Vedran Pavić, Jay Bryant, Madhura Bhave, Eddú Meléndez, Scott Frederick 2.6.0-SNAPSHOT Table of Contents 1. Legal . 2 2. Getting Help . 3 3. Documentation Overview . 4 3.1. First Steps . 4 3.2. Upgrading From an Earlier Version . 4 3.3. Developing with Spring Boot . 4 3.4. Learning About Spring Boot Features . 4 3.5. Web . 5 3.6. Data . 5 3.7. Messaging . 5 3.8. IO . 5 3.9. Container Images . 6 3.10. Advanced Topics . 6 4. Getting Started . 7 4.1. Introducing Spring Boot . 7 4.2. System Requirements . 7 4.2.1. Servlet Containers. 7 4.3. Installing Spring Boot . 8 4.3.1. Installation Instructions for the Java Developer . 8 Maven Installation . 8 Gradle Installation . 9 4.3.2. Installing the Spring Boot CLI . 9 Manual Installation . 9 Installation with SDKMAN!. 9 OSX Homebrew Installation . 10 MacPorts Installation . 11 Command-line Completion. 11 Windows Scoop Installation. 11 Quick-start Spring CLI Example . 11 4.4. Developing Your First Spring Boot Application. 12 4.4.1. Creating the POM . 13 4.4.2. Adding Classpath Dependencies . 15 4.4.3. Writing the Code . 15 The @RestController and @RequestMapping Annotations . 16 The @EnableAutoConfiguration Annotation . 16 The “main” Method . 17 4.4.4. Running the Example. 17 4.4.5. Creating an Executable Jar . 17 4.5. What to Read Next . 19 5. Upgrading Spring Boot . 21 5.1. Upgrading from 1.x .
    [Show full text]
  • 3. Introducing Spring Cloud Stream
    Spring Cloud Stream Reference Guide Sabby Anandan, Marius Bogoevici, Eric Bottard, Mark Fisher, Ilayaperumal Gopinathan, Gunnar Hillert, Mark Pollack, Patrick Peralta, Glenn Renfro, Thomas Risberg, Dave Syer, David Turanski, Janne Valkealahti, Benjamin Klein, Soby Chacko, Vinicius Carvalho, Gary Russell, Oleg Zhurakousky, Jay Bryant Copyright © Spring Cloud Stream Reference Guide Table of Contents I. Spring Cloud Stream Core ....................................................................................................... 1 1. Quick Start ..................................................................................................................... 2 1.1. Creating a Sample Application by Using Spring Initializr ......................................... 2 1.2. Importing the Project into Your IDE ....................................................................... 4 1.3. Adding a Message Handler, Building, and Running ................................................ 4 2. What’s New in 2.0? ........................................................................................................ 6 2.1. New Features and Components ............................................................................ 6 2.2. Notable Enhancements ........................................................................................ 6 Both Actuator and Web Dependencies Are Now Optional ...................................... 6 Content-type Negotiation Improvements ............................................................... 7 2.3. Notable
    [Show full text]
  • Microprofile Reactive Messaging Specification
    MicroProfile Reactive Messaging Specification James Roper, Clement Escoffier, Gordon Hutchison 1.0, July 04, 2019 Table of Contents MicroProfile Reactive Messaging . 2 Rationale. 3 Reactive Systems . 3 On JMS and Message Driven Beans . 4 Use cases. 4 Architecture . 6 Concepts . 6 Overall architecture . 6 Channel . 6 Message . 7 Message consumption with @Incoming . 7 Message production with @Outgoing. 8 Method consuming and producing. 8 Connectors. 9 Message stream operation . 9 Supported CDI scopes . 10 Supported method signatures. 11 Methods producing data . 11 Methods consuming data. 13 Methods processing data . 15 Examples of simple method streams . 20 Examples of methods using Reactive Streams or MicroProfile Reactive Streams Operators types 20 Message acknowledgement. 21 Acknowledgement Examples . 25 Connector. 27 Connector concepts. 28 Configuration . 29 Acknowledgement. 30 Specification: MicroProfile Reactive Messaging Specification Version: 1.0 Status: Final Release: July 04, 2019 Copyright (c) 2018-2019 Contributors to the Eclipse Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 1 MicroProfile Reactive Messaging 2 Rationale State-of-the-art systems must be able to adapt themselves to emerging needs and requirements, such as market change and user expectations but also fluctuating load and inevitable failures.
    [Show full text]
  • Reactive for the Impatient (Java Edition)
    Reactive for the Impatient (Java Edition) Mary Grygleski Java Developer Advocate @mgrygles DOC ID / Month XX, 2018 / © 2018 IBM Corporation A Gentle Intro to Reactive Programming and Reactive Systems with a survey of 4 popular Reactive Java tools and libraries: RxJava Spring Reactor Akka Eclipse Vert.x 2 Why Reactive? 3 Evolving changes/demands in the Computing Ecosystem • Hardware level • * Virtualization and cloud strategies • Software System Level • Software Application Level • The impatient human beings! 4 What is Reactive? 5 Reactive Manifesto https://www.reactivemanifesto.org Version 2.0 (September 2014) * More flexible systems *Highly responsive *More tolerant of failures *Handling of failures 6 DOC ID / Month XX, 2018 / © 2018 IBM Corporation Reactive Principles 7 DOC ID / Month XX, 2018 / © 2018 IBM Corporation Important distinctions… Reactive Functional Reactive Programming Programming Reactive Systems and Architecture 8 Event-Driven vs Message-Driven 9 An Interesting ”Reactive” Use Case: Menya Musashi Ramen Shop in Tokyo 10 Reactive Programming: Patterns, Terminologies • Reactivity • Events • Streams • Observables Design Patterns: Observer, Composite, Iterator 11 Rx Marble Diagram 12 Rx Marble Diagram: Map() Output: Observable.just(1, 2, 3) .map(x -> 10 * x) item: 10 .subscribe(x -> Timber.d("item: " + x))); item: 20 item: 30 Source: https://rxmarbles.com 13 Reactive Systems Design: Patterns • State Management and Persistence Patterns • Flow Control Patterns • Message Flow Patterns • Fault Tolerance and Recovery Patterns • Replication
    [Show full text]
  • Asynchronous Stream Processing with Akka Streams
    Asynchronous stream processing with Akka streams Johan Andrén JFokus, Stockholm, 2017-02-08 Johan Andrén Akka Team Stockholm Scala User Group Akka Make building powerful concurrent & distributed applications simple. Akka is a toolkit and runtime for building highly concurrent, distributed, and resilient message-driven applications on the JVM What’s in the toolkit? Actors – simple & high performance concurrency Cluster / Remoting – location transparency, resilience Cluster tools – and more prepackaged patterns Streams – back-pressured stream processing Persistence – Event Sourcing HTTP – complete, fully async and reactive HTTP Server Oficial Kafka, Cassandra, DynamoDB integrations, tons more in the community Complete Java & Scala APIs for all features Reactive Streams Reactive Streams timeline Akka Streams, Rx Vert.x, MongoDB, … Apr 2015 Oct 2013 Reactive Streams Spec 1.0 RxJava, Akka and Twitter- TCK people meeting 5+ impls “Soon thereafer” 2013 ??? 2015 Reactive Streams JEP-266 Expert group formed inclusion in JDK9 Reactive Streams Reactive Streams is an initiative to provide a “standard for asynchronous stream processing with non-blocking back pressure. This encompasses eforts aimed at runtime environments (JVM and JavaScript) as well as network protocols http://www.reactive-streams.org Reactive Streams Reactive Streams is an initiative to provide a “standard for asynchronous stream processing with non-blocking back pressure. This encompasses eforts aimed at runtime environments (JVM and JavaScript) as well as network protocols http://www.reactive-streams.org
    [Show full text]
  • Akka Scala Documentation Release 2.4.20
    Akka Scala Documentation Release 2.4.20 Lightbend Inc August 10, 2017 CONTENTS 1 Security Announcements1 1.1 Receiving Security Advisories....................................1 1.2 Reporting Vulnerabilities.......................................1 1.3 Security Related Documentation...................................1 1.4 Fixed Security Vulnerabilities....................................1 2 Introduction 4 2.1 What is Akka?............................................4 2.2 Why Akka?..............................................5 2.3 Getting Started............................................6 2.4 The Obligatory Hello World..................................... 10 2.5 Use-case and Deployment Scenarios................................. 10 2.6 Examples of use-cases for Akka................................... 11 3 General 13 3.1 Terminology, Concepts........................................ 13 3.2 Actor Systems............................................ 15 3.3 What is an Actor?.......................................... 17 3.4 Supervision and Monitoring..................................... 19 3.5 Actor References, Paths and Addresses............................... 24 3.6 Location Transparency........................................ 30 3.7 Akka and the Java Memory Model.................................. 31 3.8 Message Delivery Reliability.................................... 33 3.9 Configuration............................................. 38 4 Actors 102 4.1 Actors................................................ 102 4.2 Akka Typed.............................................
    [Show full text]