Ejemplo n.º 1
0
    public async Task HandleApplicationMessageReceivedAsync(MqttApplicationMessageReceivedEventArgs eventArgs)
    {
        var consumeResult = new ConsumeMessageResult(_topics);

        consumeResult.SetMessageAsync(eventArgs.ApplicationMessage);
        consumeResult.PublishToDomainAsync(_serviceProvider, _logger, CancellationToken.None);
    }
Ejemplo n.º 2
0
    private void HandleApplicationMessageReceivedAsync(RedisChannel channel, RedisValue value)
    {
        var consumeResult = new ConsumeMessageResult(_topics);
        var message       = new RedisMessage()
        {
            Payload = value,
            Topic   = channel
        };

        consumeResult.SetMessageAsync(message);
        consumeResult.PublishToDomainAsync(_serviceProvider, _logger, CancellationToken.None);
    }
Ejemplo n.º 3
0
        public static bool TryConsumeMessage(this IConsumer <Ignore, string> consumer, int timeOut,
                                             ConsumeMessageResult result, CancellationToken cancellationToken)
        {
            if (!TryConsume(consumer, timeOut, out var consumeResult, cancellationToken))
            {
                return(false);
            }

            result.SetMessageAsync(consumeResult);

            return(true);
        }