src/gluten/Topology/SqsPusher.cs
/// <summary>
/// Pushes a command to be routed to a queue with a delay.
/// It allows scheduled execution of jobs.
/// Routing is controlled at configuration time through .Routing
/// </summary>
/// <param name="command"></param>
/// <param name="delay"></param>
/// <typeparam name="T"></typeparam>
Pushes a command to be routed to a queue with a delay.
It allows scheduled execution of jobs.
Routing is controlled at configuration time through .Routing
Pushes a command to be routed to a queue with a delay . It allows scheduled execution of jobs . Routing is controlled at configuration time through . Routing
public void PushDelayed<T>(T command, TimeSpan delay)
            where T : ICommand
        {
            var queueUrl = _routeMap.GetQueueUrl<T>();
            if (delay <= _maxMessageDelay)
            {
                var messageString = _serializer.GetString(command);
                _sqsClient.SendDelayedMessage(messageString, queueUrl, (int)delay.TotalSeconds);
                _log.DebugFormat("Command of type {0} pushed to queue {1} with a delay of {2} seconds.",
                    typeof(T), queueUrl, delay);
            }
            else
            {
                var remainingDelay = delay - _maxMessageDelay;
                var delayedCommand = new DelayedCommand<T>
                {
                    Command = command,
                    RemainingDelay = remainingDelay
                };
                var messageString = _serializer.GetString(delayedCommand);
                _sqsClient.SendDelayedMessage(messageString, queueUrl, (int)_maxMessageDelay.TotalSeconds);
                _log.DebugFormat("Command of type {0} pushed to queue {1} with a delay of {2} seconds.",
                    typeof(T), queueUrl, delay);
            }
        }
public void PushDelayed < T > ( T command , TimeSpan delay ) where T : ICommand { var queueUrl = _routeMap . GetQueueUrl < T > ( ) ; if ( delay <= _maxMessageDelay ) { var messageString = _serializer . GetString ( command ) ; _sqsClient . SendDelayedMessage ( messageString , queueUrl , ( int ) delay . TotalSeconds ) ; _log . DebugFormat ( " " , typeof ( T ) , queueUrl , delay ) ; } else { var remainingDelay = delay - _maxMessageDelay ; var delayedCommand = new DelayedCommand < T > { Command = command , RemainingDelay = remainingDelay } ; var messageString = _serializer . GetString ( delayedCommand ) ; _sqsClient . SendDelayedMessage ( messageString , queueUrl , ( int ) _maxMessageDelay . TotalSeconds ) ; _log . DebugFormat ( " " , typeof ( T ) , queueUrl , delay ) ; } }
Pushes a command to be routed to a queue with a delay.
Pushes a command to be routed to a queue with a delay .
command
T
None
delay
TimeSpan
None
typeparam
None