public IMessageSessionAsyncHandler CreateInstance(MessageSession session, BrokeredMessage message)
 {
     if (!this.wrapSyncHandler)
     {
         return((IMessageSessionAsyncHandler)this.factoryFunction());
     }
     return(new MessageSessionHandlerFactory.SyncHandlerAdapter((IMessageSessionHandler)this.factoryFunction(), true));
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
     }
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 void Microsoft.ServiceBus.Messaging.IMessageSessionHandler.OnMessage(MessageSession session, BrokeredMessage message)
 {
     this.OnMessage(session, message);
 }
Ejemplo n.º 8
0
 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)));
 }
Ejemplo n.º 12
0
 Task Microsoft.ServiceBus.Messaging.IMessageSessionAsyncHandler.OnMessageAsync(MessageSession session, BrokeredMessage message)
 {
     return(this.OnMessageAsync(session, message));
 }
Ejemplo n.º 13
0
 protected abstract Task OnMessageAsync(MessageSession session, BrokeredMessage message);
Ejemplo n.º 14
0
 protected virtual Task OnCloseSessionAsync(MessageSession session)
 {
     return(CompletedTask.Default);
 }
Ejemplo n.º 15
0
 protected virtual void OnCloseSession(MessageSession session)
 {
 }
Ejemplo n.º 16
0
 protected abstract void OnMessage(MessageSession session, BrokeredMessage message);
Ejemplo n.º 17
0
 Task Microsoft.ServiceBus.Messaging.IMessageSessionAsyncHandler.OnCloseSessionAsync(MessageSession session)
 {
     return(this.OnCloseSessionAsync(session));
 }