HystrixCommandStartStream(final HystrixCommandKey commandKey) { this.commandKey = commandKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create()); this.readOnlyStream = writeOnlySubject.share(); }
HystrixCommandCompletionStream(final HystrixCommandKey commandKey) { this.commandKey = commandKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create()); this.readOnlyStream = writeOnlySubject.share(); }
HystrixCollapserEventStream(final HystrixCollapserKey collapserKey) { this.collapserKey = collapserKey; this.writeOnlyStream = new SerializedSubject<HystrixCollapserEvent, HystrixCollapserEvent>(PublishSubject.<HystrixCollapserEvent>create()); this.readOnlyStream = writeOnlyStream.share(); }
HystrixThreadPoolCompletionStream(final HystrixThreadPoolKey threadPoolKey) { this.threadPoolKey = threadPoolKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create()); this.readOnlyStream = writeOnlySubject.share(); }
HystrixThreadPoolStartStream(final HystrixThreadPoolKey threadPoolKey) { this.threadPoolKey = threadPoolKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create()); this.readOnlyStream = writeOnlySubject.share(); }
HystrixCollapserEventStream(final HystrixCollapserKey collapserKey) { this.collapserKey = collapserKey; this.writeOnlyStream = new SerializedSubject<HystrixCollapserEvent, HystrixCollapserEvent>(PublishSubject.<HystrixCollapserEvent>create()); this.readOnlyStream = writeOnlyStream.share(); }
HystrixCommandStartStream(final HystrixCommandKey commandKey) { this.commandKey = commandKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create()); this.readOnlyStream = writeOnlySubject.share(); }
HystrixThreadPoolCompletionStream(final HystrixThreadPoolKey threadPoolKey) { this.threadPoolKey = threadPoolKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create()); this.readOnlyStream = writeOnlySubject.share(); }
HystrixThreadPoolStartStream(final HystrixThreadPoolKey threadPoolKey) { this.threadPoolKey = threadPoolKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create()); this.readOnlyStream = writeOnlySubject.share(); }
HystrixCommandCompletionStream(final HystrixCommandKey commandKey) { this.commandKey = commandKey; this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create()); this.readOnlyStream = writeOnlySubject.share(); }
@Test public void test2() throws Exception { Subject<Long, Long> subject = PublishSubject.create(); Observable<Long> initialObservable = subject.share() .map(value -> { System.out.println("Received value " + value); new Exception().printStackTrace(System.out); return value; }); Observable<Long> timeoutObservable = initialObservable.map(value -> { System.out.println("Timeout received value " + value); return value; }); TestSubscriber<Long> subscriber = new TestSubscriber<>(); initialObservable .doOnUnsubscribe(() -> System.out.println("Unsubscribed")) .timeout(1, TimeUnit.SECONDS, timeoutObservable).subscribe(subscriber); subject.onNext(5L); Thread.sleep(1500); subject.onNext(10L); subject.onCompleted(); subscriber.awaitTerminalEvent(); subscriber.assertNoErrors(); subscriber.assertValues(5L, 10L); }
Observable<Long> initialObservable = subject.share() .map(value -> { System.out.println("Received value " + value);