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