Esempio n. 1
0
        public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (!await ValidateInputAsync(envelope, cancellationToken))
            {
                return;
            }

            // Configure for the next receiver
            if (_settings.Validation != null)
            {
                var validationJson = JsonConvert.SerializeObject(_settings, Application.SerializerSettings);
                await _sessionManager.AddVariableAsync(envelope.From, INPUT_SETTINGS_KEY, validationJson, cancellationToken);
            }

            // Set the out state
            if (_settings.SuccessOutState != null)
            {
                await _stateManager.SetStateAsync(envelope.From.ToIdentity(), _settings.SuccessOutState, cancellationToken);
            }

            // Send the label
            await _sender.SendMessageAsync(_settings.Label.ToDocument(), envelope.From, cancellationToken);
        }