Reactive Programming - Terminology

Reactive Programming - Terminology

  1. Asynchronous and non-blocking
    1. Asynchronous execution is a way of executing code without the top-down flow of the code.
    2. In a synchronous way, if there is a blocking call, like calling a database or calling a 3rd party API, the execution flow will be blocked. But in a non-blocking and asynchronous way, the execution flow will not be blocked. Rather than that, futures and callbacks will be used in asynchronous code execution.
  2. Asynchronous Data Stream
    1. A stream of data that emits values one at a time with a delay between them is known as an asynchronous data stream. According to the definition of the word “asynchronous,” the data that is released may emerge at any time, such as after a second or even two minutes.
  3. Producer:
    1. The producer acts as a data source and will always publish events.
    2. The following terms are used interchageably.
      1. Publisher
      2. Source
      3. Observable
      4. Upstream
      5. Producer
  4. Subscriber:
    1. The subscriber essentially “listens” to the events from the producer. The subscriber subscribes and consumes those events.
    2. The following terms are used interchageably.
      1. Subscriber
      2. Sink
      3. Observer
      4. Downstream
      5. Consumer
  5. Processor:
    1. Between the Publisher and the Subscriber, a processor acts as a middleman. A professor first subscribes to a publisher. Then, a subscriber subscribes to a processor.
    2. The following terms are used interchageably.
      1. Processor
      2. Operator
  6. Stream:
    1. It is a series of events that are ordered in time. A stream can emit three different types of signals: A value (a value of a certain type), an error, or a completed signal.
  7. Event/Message Driven stream data flow
    1. In reactive programming, data will flow like a stream and because it is reactive, there will be an event and a response message to that event.
    2. In the traditional way, when we get data from a data source (Eg: database, API), all the data will be fetched at once.
    3. In an event-driven stream, the data will be fetched one by one and it will be fetched as an event to the consumer.
  8. Functional style code
    1. In Java, we write lambda expressions for Functional Programming. Lambda expressions are functional style codes. In reactive programming, we mostly use this lambda expression style.
  9. Back Pressure
    1. In reactive streams when a reactive application (Consumer) is consuming data from the Producer, the producer will publish data to the application continuously as a stream.
    2. Sometimes the application cannot process the data at the speed of the producer.
    3. In this case, the consumer can notify the producer to slow down the data publishing.

Links to this note