public static async Task <AmqpMessage> ReceiveMessageAsync(this ReceivingAmqpLink link, TimeSpan timeout) { AmqpMessage message = null; await Task.Factory.FromAsync( (c, s) => link.BeginReceiveMessage(timeout, c, s), (r) => link.EndReceiveMessage(r, out message), link); return(message); }