コード例 #1
0
        public async Task <MqMessage> PeekMessage(CancellationToken cancellationToken = default)
        {
            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.PeekMessageWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
            {
                Models.MessageDto dto = response.AsResult <Models.MessageDto>();
                return(MqMessage.FromDto(dto));
            }
        }
コード例 #2
0
        public async Task <MqMessage> AddMessage(MqCreateMessage message, CancellationToken cancellationToken = default)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.CreateMessageWithHttpMessagesAsync(id, message.ToDto(), null, cancellationToken).ConfigureAwait(false))
            {
                Models.MessageDto dto = response.AsResult <Models.MessageDto>();
                return(MqMessage.FromDto(dto));
            }
        }
コード例 #3
0
        public async Task <MqMessage> GetMessage(System.TimeSpan?nextVisibilityTimeSpan = null, CancellationToken cancellationToken = default)
        {
            Guid id = await this.EndshureQueuId(cancellationToken).ConfigureAwait(false);

            Models.ExchangeModel model = new Models.ExchangeModel()
            {
                NextVisibleInMs = nextVisibilityTimeSpan.HasValue ? (int?)(nextVisibilityTimeSpan.Value.TotalMilliseconds) : null
            };

            using (Microsoft.Rest.HttpOperationResponse <object> response = await this.passiveMqApi.ExchangeWithHttpMessagesAsync(id, model, null, cancellationToken).ConfigureAwait(false))
            {
                Models.MessageDto dto = response.AsResult <Models.MessageDto>();
                return(MqMessage.FromDto(dto));
            }
        }