I have a Observable from BlockCollection that i use like a queue
IObservable<ProcessHoldTransactionData> GetObservable()
{
_queue.GetConsumingEnumerable().ToObservable(TaskPoolScheduler.Default);
}
and subscribe to him:
void StartSubscription()
{
_subscription = = GetObservable().Subscribe(
data => OnNextSubscribe(data),
ex => _logger.Error("Error"),
() => _logger.Warn("Complete"));
}
now I have another Observable:
var timer = Observable.Interval(TimeSpan.FromSeconds(60));
_subscriptionTimer = timer.Subscribe(tick =>
{
OnTimerNextSubscribe();
});
I would like when the OnTimerNextSubscribe start to STOP the subscribe of _subscription and renew it when the OnTimerNextSubscribe finish.
What the best paractice to that?
Should I dispose the _subscription and call StartSubscription()