The response from the last call in a SOA job doesn't arrive until BrokerClient.EndRequests() is invoked RRS feed

  • Question

  • Hi,

    I'm trying to implement error management for failed calls in a SOA job. For this I'm sending a code within the Fault returned in the callback, and with that code I should be able to repeat the call to the BrokerClient.

    To do that, I cannot invoke BrokerClient.EndRequests() until all the calls have been computed and responses received, because I might need to send more calls. The problem is that the last call made always waits to respond until BrokerClient.EndRequests() is invoked. I've tried using BrokerClient.Flush(), that should apparently commit all cals, but it doesn't make a difference.

    The funny thing is that in the HPC Management Console I can see that all calls have been made and computed, so obviously my client is waiting on something to retrieve the response from the last call.

    This are some code fragments that can help to explain the problem, this is the call submission loop, that waits until all the calls have responded to invoke EndRequests():

                    // Make the N service calls:
                    for (int i = 0; i < tasks; i++)
                        proxy.SendRequest(new ServiceReference.RunTaskRequest(i, taskTime, taskFailureChance));


                    // wait on callbacks

                    Console.WriteLine("{0} - End requests: {1}ms", DateTime.Now, System.Environment.TickCount - m_start);


    And this is the code inside the callback method:

                    int[] r = response.Result.RunTaskResult;
                    taskResults.Add(r[0], r); // First field returned should be the task (call) id.
                catch (FaultException fex)

                if (taskResults.Count == tasks)
                    Console.WriteLine("{0} - Received all tasks: {1}ms", DateTime.Now, System.Environment.TickCount - m_start);


    Any ideas on what could I do to receive all the responses without having to invoke EndRequests()?


    Wednesday, September 26, 2012 1:35 AM

All replies

  • The same problem is occurring here.

    Any ideas how to solve this?

    Monday, March 11, 2013 12:04 PM
  • If you don't call EndRequest(), there's no way for the HPC cluster to know whether this is the last request or not therefore it cannot set the property "IsLastResponse" on the response. If you don't need the property "IsLastResponse", you can set the Behaviors of BrokerClient to indicate you want to get all the responses even the EndRequest() is not invoked.

    The code to set the Bahviors looks like:

    client.Behaviors = BrokerClientBehaviors.None;

    BrokerClientBehaviors.EnableIsLastResponseProperty means you want the BrokerResponse.IsLastResponse is set but the last response won't return until the EndRequest() is invoked (Defautl behavior)

    BrokerClientBehaviors.None means you want all the responses return even the EndRequest() is not invoked. You cannot rely on BrokerResponse.IsLastResponse to check whether the response is the last one in such situation.

    Monday, March 18, 2013 2:52 AM