public IMessageSessionAsyncHandler CreateInstance(MessageSession session, BrokeredMessage message) { if (!this.wrapSyncHandler) { return((IMessageSessionAsyncHandler)this.factoryFunction()); } return(new MessageSessionHandlerFactory.SyncHandlerAdapter((IMessageSessionHandler)this.factoryFunction(), true)); }
private void SetState(TrackingContext trackingContext, Stream stream) { if (trackingContext == null) { trackingContext = TrackingContext.GetInstance(Guid.NewGuid(), this.Path); } MessageSession.TraceSetState(EventTraceActivity.CreateFromThread(), trackingContext, this.SessionId); this.OnSetState(trackingContext, stream, this.OperationTimeout); }
private Stream GetState(TrackingContext trackingContext) { if (trackingContext == null) { trackingContext = TrackingContext.GetInstance(Guid.NewGuid(), this.Path); } MessageSession.TraceGetState(EventTraceActivity.CreateFromThread(), trackingContext, this.SessionId); return(this.OnGetState(trackingContext, this.OperationTimeout)); }
public RetrySessionAsyncResult(MessageSession session, TrackingContext trackingContext, MessageSession.SessionOperation operation, Stream stream, TimeSpan timeout, AsyncCallback callback, object state) : base(timeout, callback, state) { if (trackingContext == null) { throw Fx.Exception.ArgumentNull("trackingContext"); } if (session == null) { throw Fx.Exception.ArgumentNull("session"); } this.session = session; this.operation = operation; this.stream = stream; this.trackingContext = trackingContext; }
public void RenewLock() { base.ThrowIfDisposed(); try { TrackingContext instance = TrackingContext.GetInstance(Guid.NewGuid(), this.Path); MessageSession.TraceRenewLock(EventTraceActivity.CreateFromThread(), instance); this.LockedUntilUtc = this.OnRenewLock(instance, this.OperationTimeout); } catch (Exception exception1) { Exception exception = exception1; if (!Fx.IsFatal(exception)) { throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(exception, null); } throw; } }
public IAsyncResult BeginSetState(Stream stream, AsyncCallback callback, object state) { IAsyncResult asyncResult; base.ThrowIfDisposed(); try { TrackingContext instance = TrackingContext.GetInstance(Guid.NewGuid(), this.Path); MessageSession.TraceSetState(EventTraceActivity.CreateFromThread(), instance, this.SessionId); MessageSession.RetrySessionAsyncResult retrySessionAsyncResult = new MessageSession.RetrySessionAsyncResult(this, instance, MessageSession.SessionOperation.SetState, stream, this.OperationTimeout, callback, state); retrySessionAsyncResult.Start(); asyncResult = retrySessionAsyncResult; } catch (Exception exception1) { Exception exception = exception1; if (!Fx.IsFatal(exception)) { throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(exception, null); } throw; } return(asyncResult); }
void Microsoft.ServiceBus.Messaging.IMessageSessionHandler.OnMessage(MessageSession session, BrokeredMessage message) { this.OnMessage(session, message); }
void Microsoft.ServiceBus.Messaging.IMessageSessionHandler.OnCloseSession(MessageSession session) { this.OnCloseSession(session); }
IMessageSessionAsyncHandler Microsoft.ServiceBus.Messaging.IMessageSessionAsyncHandlerFactory.CreateInstance(MessageSession session, BrokeredMessage message) { return(new MessageSessionHandlerFactory.SyncHandlerAdapter(this.syncFactory.CreateInstance(session, message), false)); }
Task Microsoft.ServiceBus.Messaging.IMessageSessionAsyncHandler.OnMessageAsync(MessageSession session, BrokeredMessage message) { return(Task.Factory.StartNew(() => this.syncHandler.OnMessage(session, message))); }
Task Microsoft.ServiceBus.Messaging.IMessageSessionAsyncHandler.OnCloseSessionAsync(MessageSession session) { return(Task.Factory.StartNew(() => this.syncHandler.OnCloseSession(session))); }
Task Microsoft.ServiceBus.Messaging.IMessageSessionAsyncHandler.OnMessageAsync(MessageSession session, BrokeredMessage message) { return(this.OnMessageAsync(session, message)); }
protected abstract Task OnMessageAsync(MessageSession session, BrokeredMessage message);
protected virtual Task OnCloseSessionAsync(MessageSession session) { return(CompletedTask.Default); }
protected virtual void OnCloseSession(MessageSession session) { }
protected abstract void OnMessage(MessageSession session, BrokeredMessage message);
Task Microsoft.ServiceBus.Messaging.IMessageSessionAsyncHandler.OnCloseSessionAsync(MessageSession session) { return(this.OnCloseSessionAsync(session)); }