-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.java
More file actions
32 lines (23 loc) · 1.06 KB
/
Main.java
File metadata and controls
32 lines (23 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package Task_4;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.observables.ConnectableObservable;
public class Main {
private static final int PERIOD_MULTIPLIER = 7;
public static void main(String[] args) {
GeneratorFile generatorFile = new GeneratorFile(
new String[]{"XML", "JSON", "XLS"},
10, 100,
100, 1000
);
FileQueue fileQueue = new FileQueue(5);
FileDataHandler handlerXML = new FileDataHandler(PERIOD_MULTIPLIER, "XML");
FileDataHandler handlerJSON = new FileDataHandler(PERIOD_MULTIPLIER, "JSON");
FileDataHandler handlerXLS = new FileDataHandler(PERIOD_MULTIPLIER, "XLS");
Observable.create(generatorFile).subscribe(fileQueue);
ConnectableObservable<FileData> observableFileQueue = Observable.create(fileQueue).publish();
observableFileQueue.subscribe(handlerXML);
observableFileQueue.subscribe(handlerJSON);
observableFileQueue.subscribe(handlerXLS);
observableFileQueue.connect();
}
}