void TransparentStreamGetPositionRequestMessageReceived(TransparentStreamMessageBase transparentStreamMessageBase) { TransparentStreamGetPositionRequestMessage request = (TransparentStreamGetPositionRequestMessage)transparentStreamMessageBase; Exception exception = null; long position = -1; try { position = baseStream.Length; } catch (Exception ex) { exception = ex; } objectBusSession.SendMessage(new TransparentStreamGetPositionResponseMessage(streamID, request.ID, position, exception)); }
public IAsyncResult BeginGetPosition () { TransparentStreamGetPositionRequestMessage request = new TransparentStreamGetPositionRequestMessage (Guid.NewGuid (), streamID); TransparentStreamAsyncResult result = new TransparentStreamAsyncResult (null); if (!pendingGetPositionRequests.TryAdd (request.ID, result)) { throw new Exception ("request failed before sending."); } objectBusSession.SendMessage (request); return result; }