none
Unable to get responses from DurableSession until session is completed RRS feed

  • Question

  • I have a client WCF service that, inside of one operation, establishes a DurableSession and submits several thousand requests before returning. In another separate operation, it attaches to the session and requests responses via GetResponses<>. Essentially, I am exposing the asynchronous nature of the DurableSession through a WCF service instead of having clients use the HPC API directly.

    However, when the service actually calls GetResponses<>, what I'm finding is that I am not able to get _any_ responses until _all_ of the submitted requests are processed. In fact, if I call GetResponses<> while requests are still processing, the service hangs for an inordinately long time (I've experienced 40+ minutes) before even throwing a TimeoutException, despite specifying a 60-second timeout for the GetResponses<> call.

    Is this the expected behavior? If so, is there a configuration option or other parameter that can be set to override this behavior so that the service can pick up completed responses while there are outstanding/processing requests?

     

    Request operation:

     

    var startInfo = new SessionStartInfo ("Headnode", "MyService")
    {
     MinimumUnits = 1,
     MaximumUnits = 4,
     SessionResourceUnitType = SessionUnitType.Core,
    };
    
    using (var session = DurableSession.CreateSession (startInfo))
    using (var broker = new BrokerClient<IMyService> (session))
    {
     IEnumerable<MyRequest> requests = Enumerable
      .Range (1, 2500)
      .Select (i => new MyRequest());
    
     foreach (var request in requests)
      broker.SendRequest<MyRequest> (request);
    
     broker.EndRequests();
    }
    
    Response operation:

    var attachInfo = new SessionAttachInfo ("Headnode", sessionId);
    
    using (var session = DurableSession.AttachSession (attachInfo))
    using (var broker = new BrokerClient<IMyService> (session))
    {
     bool lastResponse = false;
     while (!lastResponse)
     {
      try
      {
       responses.AddRange (broker
        .GetResponses<MyResponse> (60000)
        .Select (br =>
        {
          lastResult = br.IsLastResponse;
          return br.Result;
        }));
      }
      catch (TimeoutException)
      {
      }
     }
    
     broker.Close();
     session.Close();
    }
    

     

    • Edited by Kramer00000000 Wednesday, August 4, 2010 6:06 PM Reformatted for clarity
    Wednesday, August 4, 2010 6:02 PM

All replies

  • This is designed behavior. DurableSession won't return result until EndRequest() is called. If you want the result back on the fly, you can use non-durable session.

     

    Thursday, August 5, 2010 9:13 AM