RxJava Hello World

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.dogukanhan</groupId>
  <artifactId>rxexample</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
    <!-- https://mvnrepository.com/artifact/io.reactivex.rxjava2/rxjava -->
  <dependency>
      <groupId>io.reactivex.rxjava2</groupId>
      <artifactId>rxjava</artifactId>
      <version>2.2.2</version>
  </dependency>
  </dependencies>
</project>
import io.reactivex.Observable;

public class HelloWorldRx {
  public static void main(String args[]) {
    Observable.create(s->{
      s.onNext("Hello World");
      s.onComplete();
    }).subscribe(hello->System.out.println(hello));
  
  
  }
  
}

 

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *