Beispiel #1
0
def runProcessSubscriber(request: Request, pool_scheduler: ThreadPoolScheduler,
                         dataSubscriber: DataSubscriber) -> None:
    rx.repeat_value(request).pipe(
        ops.subscribe_on(pool_scheduler),
        ops.map(lambda r: generate_content(r)),
    ).subscribe(
        on_next=dataSubscriber.on_next,
        on_error=dataSubscriber.on_error,
        on_completed=dataSubscriber.on_completed,
    )
Beispiel #2
0
def runProcess(request: Request, pool_scheduler: ThreadPoolScheduler) -> None:
    rx.repeat_value(request).pipe(
        ops.subscribe_on(pool_scheduler),
        ops.map(lambda r: generate_content(r)),
    ).subscribe(
        on_next=lambda response: print("PROCESS %s: %s" %
                                       (response.id, str(response))),
        on_error=lambda e: print(e),
        on_completed=lambda: print("PROCESS done!"),
    )
 def create():
     return rx.repeat_value(42, -1)
Beispiel #4
0
from rx import repeat_value
"""
this method will create an observable that will repeat the given value as per the count is given

:parameter
    value: optional. the value to be repeated
    repeat_count: optional. the number of times the given value to be repeated.

:return
    it will return an observable the will repeat the given value as per the count is given.
"""

my_repeat = repeat_value(77, 10)

my_repeat.subscribe(lambda x: print("value is {}".format(x)),
                    lambda e: print("error : {}".format(e)),
                    lambda: print("Complete"))

# result
# value is 77
# value is 77
# value is 77
# value is 77
# value is 77
# value is 77
# value is 77
# value is 77
# value is 77
# value is 77
# Complete
 def create():
     return rx.repeat_value(42, -1)
rx.create() # observable 을 생성할 때 사용

# This observable will not output anything and directly emit the complete state.
rx.empty() # 해당 observable 은 아무것도 output 하지 않고 즉시 완료 상태를 발생시킨다.

# This method creates an observable that will never reach the complete state.
rx.never() # 완료 상태에 도달할 수 없는 observable 을 생성한다.


rx.throw()
rx.interval()
rx.from_()
rx.interval()
rx.just()
rx.range()
rx.repeat_value()
rx.start()
rx.timer()

"""Mathematical"""
op.average()
op.concat()
op.count()
op.max()
op.min()
op.reduce()
op.sum()

"""Transformation"""
op.buffer()
op.group_by()