Commit 3740261a authored by yangxiaodong's avatar yangxiaodong

refactor.

parent 7454bf53
......@@ -8,6 +8,6 @@ namespace DotNetCore.CAP
/// <summary>
/// EF dbcontext type.
/// </summary>
public Type DbContextType { get; internal set; }
internal Type DbContextType { get; set; }
}
}
\ No newline at end of file
......@@ -33,12 +33,12 @@ namespace DotNetCore.CAP
/// </summary>
public const string DefaultExchangeName = "cap.default.topic";
/// <summary> The topic exchange type. </summary>
public const string ExchangeType = "topic";
/// <summary>The host to connect to.</summary>
public string HostName { get; set; } = "localhost";
/// <summary> The topic exchange type. </summary>
internal const string ExchangeType = "topic";
/// <summary>
/// Password to use when authenticating to the server.
/// </summary>
......@@ -80,8 +80,8 @@ namespace DotNetCore.CAP
public int Port { get; set; } = -1;
/// <summary>
/// Gets or sets queue message automatic deletion time. Default 10 days.
/// Gets or sets queue message automatic deletion time (in milliseconds). Default 864000000 ms (10 days).
/// </summary>
public TimeSpan XMessageTTL { get; set; } = TimeSpan.FromDays(10);
public int QueueMessageExpires { get; set; } = 864000000;
}
}
\ No newline at end of file
......@@ -54,7 +54,7 @@ namespace DotNetCore.CAP.RabbitMQ
type: RabbitMQOptions.ExchangeType,
durable: true);
var arguments = new Dictionary<string, object> { { "x-message-ttl", (int)_rabbitMQOptions.XMessageTTL.TotalMilliseconds } };
var arguments = new Dictionary<string, object> { { "x-message-ttl", (int)_rabbitMQOptions.QueueMessageExpires } };
_channel.QueueDeclare(_queueName,
durable: true,
exclusive: false,
......
......@@ -16,6 +16,6 @@ namespace DotNetCore.CAP
/// <summary>
/// EF dbcontext type.
/// </summary>
public Type DbContextType { get; internal set; }
internal Type DbContextType { get; set; }
}
}
\ No newline at end of file
......@@ -40,18 +40,18 @@ namespace DotNetCore.CAP
/// <summary>
/// Failed messages polling delay time. Default is 3 min.
/// </summary>
public TimeSpan FailedMessageWaitingInterval = TimeSpan.FromMinutes(3);
public int FailedMessageWaitingInterval { get; set; } = (int)TimeSpan.FromMinutes(3).TotalSeconds;
/// <summary>
/// We’ll invoke this call-back with message type,name,content when requeue failed message.
/// </summary>
public Action<Models.MessageType, string, string> FailedCallback { get; set; }
public Action<Models.MessageType, string, string> FailedCallback { get; set; }
/// <summary>
/// Registers an extension that will be executed when building services.
/// </summary>
/// <param name="extension"></param>
public void RegisterExtension(ICapOptionsExtension extension)
/// Registers an extension that will be executed when building services.
/// </summary>
/// <param name="extension"></param>
public void RegisterExtension(ICapOptionsExtension extension)
{
if (extension == null)
throw new ArgumentNullException(nameof(extension));
......
......@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Processor
_logger = logger;
_provider = provider;
_stateChanger = stateChanger;
_waitingInterval = _options.FailedMessageWaitingInterval;
_waitingInterval = TimeSpan.FromSeconds(_options.FailedMessageWaitingInterval);
}
public async Task ProcessAsync(ProcessingContext context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment