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); }
/// <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); }