public void Consume(SimpleRequest message) { var response = new SimpleResponse { Message = "Response created on thread: " + Thread.CurrentThread.ManagedThreadId, }; message.Reply(response); }
public IAsyncResult BeginAction(HttpContext context, AsyncCallback callback, object state) { _context = context; _asyncResult = new AsyncResult(callback, state); _body.AppendLine("Begin called on thread: " + Thread.CurrentThread.ManagedThreadId); var message = new SimpleRequest { Reply = response => _queue.Enqueue(() => Consume(response)) }; Interlocked.Increment(ref _requestCount); _requestService.SimpleRequest(message); return _asyncResult; }
public void SimpleRequest(SimpleRequest request) { _queue.Enqueue(() => Consume(request)); }