Skip to content

Commit 98acac2

Browse files
authored
Fixed image link and added java examples for Connectable Observable operators (#6997)
* Fixed image link and added java examples * 3.x:Update Getting started docs
1 parent 597d249 commit 98acac2

File tree

2 files changed

+33
-38
lines changed

2 files changed

+33
-38
lines changed

docs/Connectable-Observable-Operators.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,22 @@ This section explains the [`ConnectableObservable`](http://reactivex.io/RxJava/j
77

88
A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its `connect()` method is called. In this way you can wait for all intended Subscribers to subscribe to the Observable before the Observable begins emitting items.
99

10-
<img src="/ReactiveX/RxJava/wiki/images/rx-operators/publishConnect.v3.png" width="640" height="510" />
10+
<img src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/publishConnect.v3.png" width="640" height="510" />
1111

1212
The following example code shows two Subscribers subscribing to the same Observable. In the first case, they subscribe to an ordinary Observable; in the second case, they subscribe to a Connectable Observable that only connects after both Subscribers subscribe. Note the difference in the output:
1313

1414
**Example #1:**
15-
```groovy
16-
def firstMillion = Observable.range( 1, 1000000 ).sample(7, java.util.concurrent.TimeUnit.MILLISECONDS);
15+
```java
16+
Observable firstMillion = Observable.range(1, 1000000).sample(7, java.util.concurrent.TimeUnit.MILLISECONDS);
1717

18-
firstMillion.subscribe(
19-
{ println("Subscriber #1:" + it); }, // onNext
20-
{ println("Error: " + it.getMessage()); }, // onError
21-
{ println("Sequence #1 complete"); } // onCompleted
22-
);
23-
24-
firstMillion.subscribe(
25-
{ println("Subscriber #2:" + it); }, // onNext
26-
{ println("Error: " + it.getMessage()); }, // onError
27-
{ println("Sequence #2 complete"); } // onCompleted
28-
);
18+
firstMillion.subscribe(next -> System.out.println("Subscriber #1: " + next), // onNext
19+
throwable -> System.out.println("Error: " + throwable), // onError
20+
() -> System.out.println("Sequence #1 complete") // onComplete
21+
);
22+
firstMillion.subscribe(next -> System.out.println("Subscriber #2: " + next), // onNext
23+
throwable -> System.out.println("Error: " + throwable), // onError
24+
() -> System.out.println("Sequence #2 complete") // onComplete
25+
);
2926
```
3027
```
3128
Subscriber #1:211128
@@ -40,20 +37,18 @@ Subscriber #2:826996
4037
Sequence #2 complete
4138
```
4239
**Example #2:**
43-
```groovy
44-
def firstMillion = Observable.range( 1, 1000000 ).sample(7, java.util.concurrent.TimeUnit.MILLISECONDS).publish();
40+
```java
41+
ConnectableObservable firstMillion = Observable.range(1, 1000000).sample(7, java.util.concurrent.TimeUnit.MILLISECONDS).publish();
4542

46-
firstMillion.subscribe(
47-
{ println("Subscriber #1:" + it); }, // onNext
48-
{ println("Error: " + it.getMessage()); }, // onError
49-
{ println("Sequence #1 complete"); } // onCompleted
50-
);
43+
firstMillion.subscribe(next -> System.out.println("Subscriber #1: " + next), // onNext
44+
throwable -> System.out.println("Error: " + throwable), // onError
45+
() -> System.out.println("Sequence #1 complete") // onComplete
46+
);
5147

52-
firstMillion.subscribe(
53-
{ println("Subscriber #2:" + it); }, // onNext
54-
{ println("Error: " + it.getMessage()); }, // onError
55-
{ println("Sequence #2 complete"); } // onCompleted
56-
);
48+
firstMillion.subscribe(next -> System.out.println("Subscriber #2: " + next), // onNext
49+
throwable -> System.out.println("Error: " + throwable), // onError
50+
() -> System.out.println("Sequence #2 complete") // onComplete
51+
);
5752

5853
firstMillion.connect();
5954
```

docs/Getting-Started.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
## Getting Binaries
22

3-
You can find binaries and dependency information for Maven, Ivy, Gradle, SBT, and others at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Cg%3A"io.reactivex.rxjava2"%20AND%20"rxjava2").
3+
You can find binaries and dependency information for Maven, Ivy, Gradle, SBT, and others at [http://search.maven.org](https://search.maven.org/search?q=g:io.reactivex.rxjava3%20AND%20rxjava).
44

55
Example for Maven:
66

77
```xml
88
<dependency>
9-
<groupId>io.reactivex.rxjava2</groupId>
9+
<groupId>io.reactivex.rxjava3</groupId>
1010
<artifactId>rxjava</artifactId>
11-
<version>2.2.0</version>
11+
<version>3.0.4</version>
1212
</dependency>
1313
```
1414
and for Ivy:
1515

1616
```xml
17-
<dependency org="io.reactivex.rxjava2" name="rxjava" rev="2.2.0" />
17+
<dependency org="io.reactivex.rxjava3" name="rxjava" rev="3.0.4" />
1818
```
1919

2020
and for SBT:
2121

2222
```scala
2323
libraryDependencies += "io.reactivex" %% "rxscala" % "0.26.5"
2424

25-
libraryDependencies += "io.reactivex.rxjava2" % "rxjava" % "2.2.0"
25+
libraryDependencies += "io.reactivex.rxjava3" % "rxjava" % "3.0.4"
2626
```
2727

2828
and for Gradle:
2929
```groovy
30-
compile 'io.reactivex.rxjava2:rxjava:2.2.0'
30+
compile 'io.reactivex.rxjava3:rxjava:3.0.4'
3131
```
3232

3333
If you need to download the jars instead of using a build system, create a Maven `pom` file like this with the desired version:
@@ -38,17 +38,17 @@ If you need to download the jars instead of using a build system, create a Maven
3838
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3939
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4040
<modelVersion>4.0.0</modelVersion>
41-
<groupId>io.reactivex.rxjava2</groupId>
41+
<groupId>io.reactivex.rxjava3</groupId>
4242
<artifactId>rxjava</artifactId>
43-
<version>2.2.0</version>
43+
<version>3.0.4</version>
4444
<name>RxJava</name>
4545
<description>Reactive Extensions for Java</description>
4646
<url>https://github.com/ReactiveX/RxJava</url>
4747
<dependencies>
4848
<dependency>
49-
<groupId>io.reactivex.rxjava2</groupId>
49+
<groupId>io.reactivex.rxjava3</groupId>
5050
<artifactId>rxjava</artifactId>
51-
<version>2.2.0</version>
51+
<version>3.0.4</version>
5252
</dependency>
5353
</dependencies>
5454
</project>
@@ -66,15 +66,15 @@ You need Java 6 or later.
6666

6767
### Snapshots
6868

69-
Snapshots are available via [JFrog](https://oss.jfrog.org/libs-snapshot/io/reactivex/rxjava2/rxjava/):
69+
Snapshots are available via [JFrog](https://oss.jfrog.org/libs-snapshot/io/reactivex/rxjava3/rxjava/):
7070

7171
```groovy
7272
repositories {
7373
maven { url 'https://oss.jfrog.org/libs-snapshot' }
7474
}
7575
7676
dependencies {
77-
compile 'io.reactivex.rxjava2:rxjava:2.2.0-SNAPSHOT'
77+
compile 'io.reactivex.rxjava3:rxjava:3.0.4'
7878
}
7979
```
8080

0 commit comments

Comments
 (0)