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 8192857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:16:34+00:00 2026-06-07T04:16:34+00:00

From a client application I am sending a request/transaction (containing an operation to perform

  • 0

From a client application I am sending a request/transaction (containing an operation to perform (and parameters) + transactionID) to a remote queue. The remote server dequeue the request at some point and takes some time to process it.

Once it is done processing it, it sends a reponse on the client queue (containing the applicative response + the transactionID) … so this is a totally “disconnected” communication mode, the only way that the client can map the response to the request is via the transactionID.

Message response is dequeued on client side, and matched with the original request (based on the transactionID).

What I am doing right now is that when the client post the request to the server queue, it adds a callback to a dictionnary keeping transactionId and callback (delegate). This is a Dictionary<int, object> mapping a transactionId back to a callback to call with the result of the operation.

The callbacks/delegates are stored as object due to the fact that depending of the request, the callback delegate signature is different (for example a response may return a List<string> whereas another response may return an int).

When the client queue dequeues a response, it knows the type of the response (and therefore the corresponding signature of the callback), therefore it gets the callback from the dictionary, based on the transactionID. It then casts the object back to the corresponding delegate type and invoke the callback.

I find this approach not very “sexy” but I do not really see another way of performing such a task.

Is there any better way of performing this ?

If the problem is not clear enough, please let me know and will clarify with some edits.

  • 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-06-07T04:16:36+00:00Added an answer on June 7, 2026 at 4:16 am

    You might find Reactive Extensions a handy tool for that kind of messaging.

    First, make all your responses implement some interface or base class, like IMessage. Each kind of response should be encapsulated in a separate class like here

    public interface IMessage
    {
        int TransactionId { get; }
    }
    
    public class UserListMessage : IMessage
    {
        int TransactionId { get; set; }
        public List<string> Users { get; set; }
    }
    

    Then make your message queue implement IObservable<IMessage>. Reactive extensions provides a ready to use implementation called Subject<T>, you might want to wrap it or something.

    Observable implements a Subscribe(IObserver<IMessage> observer) method which stores observers somewhere in an internal list. When a new response arrives an OnNext(IMessage message) method is called on each subscribed observer.

    Finally, your response handling registration code might look like:

    var subscription = myQueue
        .OfType<UserListMessage>()
        .Where(msg => msg.TransactionId == id)
        .Subscribe(callback);
    

    That will register callback for a message of type UserListMessage with given transaction ID.
    Probably you will also want to unsubscribe somewhere. That will be:

    subscription.Dispose();
    

    That was a brief sample how that would look like with Rx. Now go and find some more detailed tutorial.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sending POST request from client to the application. On the server side
I want to create one simple application for sending request from iphone(client) by using
I have a client application which is sending a request to a server. Server
My application is acting as client for a banks server, sending request and getting
I am wanting to send some data to a server from a client application
In my java application I want to transfer some Images from client to server.
I am developing a client-server application using .Net Remoting. From my server I want
Started building an application here. client and server style architecture sending active resources across
How would you invoke a client flash method from application server in java applicationadapter.
I am sending some information from my application to server and waiting for the

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.