Exemple #1
0
 public virtual void OnCommandReceived(Command cmd)
 {
     CommandHandler handler = CommandReceived;
     if (handler != null)
     {
         handler(this, cmd);
     }
 }
 public override void CreateConnectionClose(ushort reasonCode,
                                            string reasonText,
                                            out Command request,
                                            out int replyClassId,
                                            out int replyMethodId)
 {
     request = new Command(new RabbitMQ.Client.Framing.Impl.v0_9.ConnectionClose(reasonCode,
                                                                                 reasonText,
                                                                                 0, 0));
     replyClassId = RabbitMQ.Client.Framing.Impl.v0_9.ConnectionCloseOk.ClassId;
     replyMethodId = RabbitMQ.Client.Framing.Impl.v0_9.ConnectionCloseOk.MethodId;
 }
 public override bool CanSendWhileClosed(Command cmd)
 {
     return cmd.m_method is RabbitMQ.Client.Framing.Impl.v0_9.ChannelCloseOk;
 }
 public virtual void HandleCommand(Command cmd)
 {
     m_cell.Value = Either.Left(cmd);
 }
 ///<summary>Used when a connection is being quiesced because
 ///of a HardProtocolException or Application initiated shutdown</summary>
 public abstract void CreateConnectionClose(ushort reasonCode,
     string reasonText,
     out Command request,
     out int replyClassId,
     out int replyMethodId);
 ///<summary>Used in the quiescing session to determine if the command
 ///is allowed to be sent.</summary>
 public abstract bool CanSendWhileClosed(Command cmd);
 private void Reset()
 {
     m_state = AssemblyState.ExpectingMethod;
     m_command = new Command();
     m_remainingBodyBytes = 0;
 }
Exemple #8
0
 public Task HandleCommand(ISession session, Command cmd)
 {
     return(m_delegate.HandleCommand(session, cmd));
 }
 public void TransmitAndEnqueue(Command cmd, IRpcContinuation k)
 {
     Enqueue(k);
     m_session.Transmit(cmd);
 }
Exemple #10
0
 public virtual void Transmit(Command cmd)
 {
     lock (m_shutdownLock)
     {
         if (m_closeReason != null)
         {
             if (!m_connection.Protocol.CanSendWhileClosed(cmd))
           	    throw new AlreadyClosedException(m_closeReason);
         }
         // We transmit *inside* the lock to avoid interleaving
         // of frames within a channel.
         cmd.Transmit(m_channelNumber, m_connection);
     }
 }
Exemple #11
0
 public override void Transmit(Command cmd)
 {
     lock(m_closingLock)
     {
         if (!m_closing)
         {
             base.Transmit(cmd);
             return;
         }
     }
      
     // Allow always for sending close ok
     // Or if application initiated, allow also for sending close
     MethodBase method = cmd.m_method;
     if ( ((method.ProtocolClassId == m_closeOkClassId)
           && (method.ProtocolMethodId == m_closeOkMethodId))
           || (!m_closeServerInitiated && (
               (method.ProtocolClassId == m_closeClassId) &&
               (method.ProtocolMethodId == m_closeMethodId))
               ))
     {
         base.Transmit(cmd);
         return;
     }
 }
 public void CreateConnectionClose(ushort reasonCode,
     string reasonText,
     out Command request,
     out int replyClassId,
     out int replyMethodId)
 {
     request = new Command(new Impl.ConnectionClose(reasonCode,
         reasonText,
         0, 0));
     replyClassId = Impl.ConnectionCloseOk.ClassId;
     replyMethodId = Impl.ConnectionCloseOk.MethodId;
 }
 public bool CanSendWhileClosed(Command cmd)
 {
     return cmd.Method is Impl.ChannelCloseOk;
 }
 public void TransmitAndEnqueue(Command cmd, IRpcContinuation k)
 {
     Enqueue(k);
     try
     {
         m_session.Transmit(cmd);
     }
     catch (AlreadyClosedException)
     {
         // Ignored, since the continuation will be told about
         // the closure via an OperationInterruptedException because
         // of the shutdown event propagation.
     }
 }
 public virtual void OnCommandReceived(Command cmd)
 {
     Action<ISession, Command> handler = CommandReceived;
     if (handler != null)
     {
         handler(this, cmd);
     }
 }
 public bool DispatchAsynchronous(Command cmd)
 {
     return m_delegate.DispatchAsynchronous(cmd);
 }
 public void HandleCommand(ISession session, Command cmd)
 {
     if (DispatchAsynchronous(cmd))
     {
         // Was asynchronous. Already processed. No need to process further.
     }
     else
     {
         m_continuationQueue.Next().HandleCommand(cmd);
     }
 }
 public void HandleCommand(ISession session, Command cmd)
 {
     m_delegate.HandleCommand(session, cmd);
 }
 public abstract bool DispatchAsynchronous(Command cmd);
Exemple #20
0
 public Task <bool> DispatchAsynchronous(Command cmd)
 {
     return(m_delegate.DispatchAsynchronous(cmd));
 }