public static CreateCommandMessage ( IAmqpSerializable command ) : AmqpMessage | ||
command | IAmqpSerializable | |
return | AmqpMessage |
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)); }
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)); }
/// <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); }
/// <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"); }