public byte[] Parse(DequeueNotificationDto dequeueNotificationDto)
        {
            ArgumentNullException.ThrowIfNull(dequeueNotificationDto, nameof(dequeueNotificationDto));

#pragma warning disable CS0618 // Type or member is obsolete
            var marketOperator = dequeueNotificationDto.MarketOperator is LegacyActorIdDto legacyActorIdDto
#pragma warning restore CS0618 // Type or member is obsolete
                ? legacyActorIdDto.LegacyValue
                : dequeueNotificationDto.MarketOperator.Value.ToString();

            var message = new DequeueContract
            {
                DataAvailableNotificationReferenceId = dequeueNotificationDto.DataAvailableNotificationReferenceId,
                MarketOperator = marketOperator
            };

            return(message.ToByteArray());
        }
示例#2
0
        public Task SendAsync(string correlationId, DequeueNotificationDto dequeueNotificationDto, DomainOrigin domainOrigin)
        {
            ArgumentNullException.ThrowIfNull(dequeueNotificationDto, nameof(dequeueNotificationDto));

            var queueName        = GetQueueName(domainOrigin);
            var serviceBusSender = _messageBusFactory.GetSenderClient(queueName);

#pragma warning disable CS0618
            var marketOperator = dequeueNotificationDto.MarketOperator is LegacyActorIdDto legacyActorIdDto
#pragma warning restore CS0618
                ? legacyActorIdDto.LegacyValue
                : dequeueNotificationDto.MarketOperator.Value.ToString();

            var contract = new DequeueContract
            {
                DataAvailableNotificationReferenceId = dequeueNotificationDto.DataAvailableNotificationReferenceId,
                MarketOperator = marketOperator
            };

            var dequeueMessage = new ServiceBusMessage(new BinaryData(contract.ToByteArray()))
                                 .AddDequeueIntegrationEvents(correlationId);

            return(serviceBusSender.PublishMessageAsync <ServiceBusMessage>(dequeueMessage));
        }