Esempio n. 1
0
        public Task <string> SendAsync(MessageEnvelope messageEnvelope, MessageBase message)
        {
            var payload = _messageFormatter.GetPayload(message);
            var sign    = _signService.SignPayload(payload, messageEnvelope.SigningKey);

            _queue.Enqueue(TransportMessage.CreateMessage(message, payload, sign));

            return(Task.FromResult(_queue.Count.ToString()));
        }
        public async Task <string> SendAsync(MessageEnvelope messageEnvelope, MessageBase message)
        {
            var payload = _messageFormatter.GetPayload(message);
            var sign    = _signService.SignPayload(payload, messageEnvelope.SigningKey);

            return(await RetryPolicy.ExecuteAsync(async() =>
            {
                return await _whisper.SendMessageAsync(
                    messageEnvelope.Topic,
                    messageEnvelope.EncryptionKey,
                    messageEnvelope.EncryptionType,
                    payload + sign);
            }));
        }