Reactive Programming with RxJava. Creating Bytom

In today...s app-driven era, when programs are asynchronous and responsiveness is so vital, reactive programming can help you write code that...s more reliable, easier to scale, and better-performing. With this practical book, Java developers will first learn how to view problems in the reactive …

od 135,15 Najbliżej: 19 km

Liczba ofert: 1

Oferta sklepu

Opis

In today...s app-driven era, when programs are asynchronous and responsiveness is so vital, reactive programming can help you write code that...s more reliable, easier to scale, and better-performing. With this practical book, Java developers will first learn how to view problems in the reactive way, and then build programs that leverage the best features of this exciting new programming paradigm.Authors Tomasz Nurkiewicz and Ben Christensen include concrete examples that use the RxJava library to solve real-world performance issues on Android devices as well as the server. You...ll learn how RxJava leverages parallelism and concurrency to help you solve today...s problems. This book also provides a preview of the upcoming 2.0 release.Write programs that react to multiple asynchronous sources of input without descending into "callback hell"Get to that aha! moment when you understand how to solve problems in the reactive wayCope with Observables that produce data too quickly to be consumedExplore strategies to debug and to test programs written in the reactive styleEfficiently exploit parallelism and concurrency in your programsLearn about the transition to RxJava version 2 Spis treści: ForewordIntroductionWho Should Read This BookNote from Ben ChristensenNote from Tomasz NurkiewiczNavigating This BookOnline ResourcesConventions Used in This BookSafari Books OnlineHow to Contact UsAcknowledgmentsFrom BenFrom Tomasz1. Reactive Programming with RxJavaReactive Programming and RxJavaWhen You Need Reactive ProgrammingHow RxJava WorksPush versus PullAsync versus SyncIn-memory dataSynchronous computation (such as operators)Concurrency and ParallelismLazy versus EagerDualityCardinalityEvent streamMultiple valuesCompositionSingleCompletableZero to infinityMechanical Sympathy: Blocking versus Nonblocking I/OReactive Abstraction2. Reactive ExtensionsAnatomy of rx.ObservableSubscribing to Notifications from ObservableCapturing All Notifications by Using ObserverControlling Listeners by Using Subscription and SubscriberCreating ObservablesMastering Observable.create()Managing multiple subscribersInfinite StreamsTiming: timer() and interval()Hot and Cold ObservablesUse Case: From Callback API to Observable StreamManually Managing Subscribersrx.subjects.SubjectConnectableObservableSingle Subscription with publish().refCount()ConnectableObservable LifecycleSummary3. Operators and TransformationsCore Operators: Mapping and Filtering1-to-1 Transformations Using map()Wrapping Up Using flatMap()Postponing Events Using the delay() OperatorOrder of Events After flatMap()Preserving Order Using concatMap()Controlling the concurrency of flatMap()More Than One ObservableTreating Several Observables as One Using merge()Pairwise Composing Using zip() and zipWith()When Streams Are Not Synchronized with One Another: combineLatest(), withLatestFrom(), and amb()withLatestFrom() operatoramb() operatorAdvanced Operators: collect(), reduce(), scan(), distinct(), and groupBy()Scanning Through the Sequence with Scan and ReduceReduction with Mutable Accumulator: collect()Asserting Observable Has Exactly One Item Using single()Dropping Duplicates Using distinct() and distinctUntilChanged()Slicing and Dicing Using skip(), takeWhile(), and OthersWays of Combining Streams: concat(), merge(), and switchOnNext()Criteria-Based Splitting of Stream Using groupBy()Where to Go from Here?Writing Customer OperatorsReusing Operators Using compose()Implementing Advanced Operators Using lift()Looking under the hood of the map() operatorOur first operatorSummary4. Applying Reactive Programming to Existing ApplicationsFrom Collections to ObservablesBlockingObservable: Exiting the Reactive WorldEmbracing LazinessComposing ObservablesLazy paging and concatenationImperative ConcurrencyflatMap() as Asynchronous Chaining OperatorReplacing Callbacks with StreamsPolling Periodically for ChangesMultithreading in RxJavaWhat Is a Scheduler?Scheduler implementation details overviewDeclarative Subscription with subscribeOn()subscribeOn() Concurrency and BehaviorBatching Requests Using groupBy()Declarative Concurrency with observeOn()Other Uses for SchedulersSummary5. Reactive from Top to BottomBeating the C10k ProblemTraditional Thread-Based HTTP ServersSingle threaded serverNonblocking HTTP Server with Netty and RxNettyObservable server with RxNettyBenchmarking Blocking versus Reactive ServerPlain server returning 200 OKsSimulating server-side workReactive HTTP Servers TourHTTP Client CodeNonblocking HTTP Client with RxNettyRelational Database AccessNOTIFY AND LISTEN on PostgreSQL Case StudyCompletableFuture and StreamsA Short Introduction to CompletableFutureInteroperability with CompletableFutureTurning CompletableFuture into Observable with single itemFrom Observable to CompletableFutureObservable versus SingleCreating and Consuming SingleCombining Responses Using zip, merge, and concatInteroperability with Observable and CompletableFutureWhen to Use Single?Summary6. Flow Control and BackpressureFlow ControlTaking Periodic Samples and ThrottlingBuffering Events to a ListBuffering by time periodsMoving windowSkipping Stale Events by Using debounce()Avoid starvation in debounce()BackpressureBackpressure in RxJavaBuilt-in BackpressureProducers and Missing BackpressureHonoring the Requested Amount of DataSummary7. Testing and TroubleshootingError HandlingWhere Are My Exceptions?Declarative try-catch ReplacementReplacing errors with a fixed result using onErrorReturn()Lazily computing fallback value using onErrorResumeNext()Timing Out When Events Do Not OccurRetrying After FailuresRetrying by using delay and limited attemptsTesting and DebuggingVirtual TimeSchedulers in Unit TestingUnit TestingVerifying emitted eventsMonitoring and DebuggingdoOn() CallbacksMeasuring and MonitoringSummary8. Case StudiesAndroid Development with RxJavaAvoiding Memory Leaks in ActivitiesRetrofit with Native RxJava SupportSchedulers in AndroidUI Events as StreamsManaging Failures with HystrixThe First Steps with HystrixNonblocking Commands with HystrixObservableCommandBulkhead Pattern and Fail-FastBatching and Collapsing CommandsMonitoring and DashboardsQuerying NoSQL DatabasesCouchbase Client APIMongoDB Client APICamel IntegrationConsuming Files with CamelReceiving Messages from KafkaJava 8 Streams and CompletableFutureUsefulness of Parallel StreamsChoosing the Appropriate Concurrency AbstractionWhen to Choose Observable?Memory Consumption and LeaksOperators Consuming Uncontrolled Amounts of Memorydistinct() caching all seen eventsBuffering events with toList() and buffer()Caching with cache() and ReplaySubjectBackpressure keeps memory usage lowSummary9. Future DirectionsReactive StreamsObservable and FlowablePerformanceMigrationA. More HTTP Server Examplesfork() Procedure in C LanguageThread per ConnectionThread Pool of ConnectionsB. A Decision Tree of Observable OperatorsIndex

Specyfikacja

Podstawowe informacje

Autor
  • Tomasz Nurkiewicz, Ben Christensen
Rok wydania
  • 2016
Format
  • MOBI
  • EPUB
Ilość stron
  • 372
Kategorie
  • Webmasterstwo
Wybrane wydawnictwa
  • O'Reilly Media