Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7002921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:59:33+00:00 2026-05-27T20:59:33+00:00

Is it possible to force multiple RX subscriptions to different observables run serially (not

  • 0

Is it possible to force multiple RX subscriptions to different observables run serially (not simultaneously)?

I am aware that I can use EventLoopScheduler for that, but that will degrade performance because all handling will be done on a single thread.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:59:34+00:00Added an answer on May 27, 2026 at 8:59 pm

    If you mean to run one observable until OnCompleted then start the next, you should look into Concat. If you mean to have multiple different observables that are subscribed to at the same time, you could use Merge (if the semantics make sense for your scenario). If Merge is not appropriate, I would recommend using one of the standard thread synchronization methods (lock, Monitor, etc) in the observer methods or the EventLoopScheduler you already know about.

    EDIT Original answer preserved below

    Yes, it is possible to force serial observer execution. However, whether you need to or not depends on the observable. In general, hot observables will already run serially, whereas cold observables will not. This is a side-effect of the difference in the way hot and cold observables work. To make a cold observable hot, and thus make observers run serially, use Publish. Here’s an example demonstrating the various behaviors.

    Sub Main()
        'hot observable, runs serially
        Dim trigger As New ObsEvent
        Dim eobs = Observable.FromEventPattern(Of ItemEventArgs(Of String))(
                        Sub(h) AddHandler trigger.Triggered, h,
                        Sub(h) RemoveHandler trigger.Triggered, h)
        Dim sub1 = eobs.Subscribe(Sub(v)
                                      Console.WriteLine("Starting event observer 1: {0}", v.EventArgs.Item)
                                      Thread.Sleep(2000)
                                      Console.WriteLine("Ending event observer 1")
                                  End Sub)
        trigger.Trigger("event trigger 1")
        Dim sub2 = eobs.Subscribe(Sub(v)
                                      Console.WriteLine("Starting event observer 2: {0}", v.EventArgs.Item)
                                      Thread.Sleep(2000)
                                      Console.WriteLine("Ending event observer 2")
                                  End Sub)
        trigger.Trigger("event trigger 2")
    
        Console.WriteLine()
        Console.WriteLine()
    
        'cold observable, runs "simultaneously"
        Dim tobs = Observable.Timer(TimeSpan.FromSeconds(5))
        sub1 = tobs.Subscribe(Sub(v)
                                  Console.WriteLine("Starting timer observer 1")
                                  Thread.Sleep(2000)
                                  Console.WriteLine("Ending timer observer 1")
                              End Sub,
                              Sub(ex) Console.WriteLine("Error"),
                              Sub() Console.WriteLine("Observer 1 completed"))
        Thread.Sleep(500)
        sub2 = tobs.Subscribe(Sub(v)
                                  Console.WriteLine("Starting timer observer 2")
                                  Thread.Sleep(2000)
                                  Console.WriteLine("Ending timer observer 2")
                              End Sub,
                              Sub(ex) Console.WriteLine("Error"),
                              Sub() Console.WriteLine("Observer 2 completed"))
    
        'cold observable turned hot, runs serially
        Dim pobs = tobs.Publish()
        sub1 = pobs.Subscribe(Sub(v)
                                  Console.WriteLine("Starting publish observer 1")
                                  Thread.Sleep(2000)
                                  Console.WriteLine("Ending publish observer 1")
                              End Sub,
                              Sub(ex) Console.WriteLine("Error"),
                              Sub() Console.WriteLine("Observer P1 completed"))
        Thread.Sleep(500)
        sub2 = pobs.Subscribe(Sub(v)
                                  Console.WriteLine("Starting publish observer 2")
                                  Thread.Sleep(2000)
                                  Console.WriteLine("Ending publish observer 2")
                              End Sub,
                              Sub(ex) Console.WriteLine("Error"),
                              Sub() Console.WriteLine("Observer P2 completed"))
        pobs.Connect()
    
        Console.ReadKey()
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Is it possible to set multiple styles for different pieces of text inside a
I am setting up a SaaS application that multiple clients will use to enter
I believe that you can't force a running Memcached instance to de-allocate memory, short
Is it possible force the browser to fresh the cached CSS? This is not
Is it possible to force History.js - https://github.com/browserstate/History.js/ - to use the hash URLs
Is it possible to force a column in a SQL Server 2005 table to
Is it possible to force the iPhone to shutdown ( programmatically , of course)?
I would like to know whether it is possible to force LWP::UserAgent to accept
In a Web application, is it possible to force a PDF file to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.