CreateCommandMessage() 공개 정적인 메소드

public static CreateCommandMessage ( IAmqpSerializable command ) : AmqpMessage
command IAmqpSerializable
리턴 AmqpMessage
예제 #1
0
        public IAsyncResult BeginDeclare(TimeSpan timeout, AsyncCallback callback, object state)
        {
            AmqpTrace.Provider.AmqpLogOperationInformational(this, TraceOperation.Execute, "BeginDeclare");
            Declare     declare = new Declare();
            AmqpMessage message = Controller.CreateCommandMessage(declare);

            return(this.sendLink.BeginSendMessage(message, this.GetDeliveryTag(), AmqpConstants.NullBinary, timeout, callback, state));
        }
예제 #2
0
        public IAsyncResult BeginDischange(ArraySegment <byte> txnId, bool fail, TimeSpan timeout, AsyncCallback callback, object state)
        {
            AmqpTrace.Provider.AmqpLogOperationInformational(this, TraceOperation.Execute, "BeginDischange");
            Discharge discharge = new Discharge()
            {
                TxnId = txnId,
                Fail  = fail
            };

            AmqpMessage message = Controller.CreateCommandMessage(discharge);

            return(this.sendLink.BeginSendMessage(message, this.GetDeliveryTag(), AmqpConstants.NullBinary, timeout, callback, state));
        }
예제 #3
0
        /// <summary>
        /// Declares a transaction.
        /// </summary>
        /// <returns>A task that returns a transaction id when it completes.</returns>
        public async Task <ArraySegment <byte> > DeclareAsync()
        {
            AmqpTrace.Provider.AmqpLogOperationInformational(this, TraceOperation.Execute, "BeginDeclare");
            Declare declare = new Declare();

            AmqpMessage   message       = Controller.CreateCommandMessage(declare);
            DeliveryState deliveryState = await Task <DeliveryState> .Factory.FromAsync(
                this.controllerLink.BeginSendMessage(message, this.GetDeliveryTag(), AmqpConstants.NullBinary, this.operationTimeout, null, null),
                this.controllerLink.EndSendMessage).ConfigureAwait(false);

            this.ThrowIfRejected(deliveryState);
            AmqpTrace.Provider.AmqpLogOperationInformational(this, TraceOperation.Execute, "EndDeclare");
            return(((Declared)deliveryState).TxnId);
        }
예제 #4
0
        /// <summary>
        /// Discharges a transaction.
        /// </summary>
        /// <param name="txnId">The transaction id.</param>
        /// <param name="fail">true if the transaction failed, false otherwise.</param>
        /// <returns></returns>
        public async Task DischargeAsync(ArraySegment <byte> txnId, bool fail)
        {
            AmqpTrace.Provider.AmqpLogOperationInformational(this, TraceOperation.Execute, "BeginDischange");
            Discharge discharge = new Discharge
            {
                TxnId = txnId,
                Fail  = fail
            };

            AmqpMessage   message       = Controller.CreateCommandMessage(discharge);
            DeliveryState deliveryState = await Task <DeliveryState> .Factory.FromAsync(
                this.controllerLink.BeginSendMessage(message, this.GetDeliveryTag(), AmqpConstants.NullBinary, this.operationTimeout, null, null),
                this.controllerLink.EndSendMessage).ConfigureAwait(false);

            this.ThrowIfRejected(deliveryState);
            AmqpTrace.Provider.AmqpLogOperationInformational(this, TraceOperation.Execute, "EndDischange");
        }