Przeglądaj źródła

Move some options config to other proejct.

master
yangxiaodong 7 lat temu
rodzic
commit
311d5e9288
5 zmienionych plików z 17 dodań i 14 usunięć
  1. +10
    -3
      src/DotNetCore.CAP.EntityFrameworkCore/ConsistencyDbContext.cs
  2. +1
    -6
      src/DotNetCore.CAP/CAP.Options.cs
  3. +1
    -3
      src/DotNetCore.CAP/IConsumerClientFactory.cs
  4. +1
    -1
      src/DotNetCore.CAP/IConsumerHandler.Default.cs
  5. +4
    -1
      src/DotNetCore.CAP/Infrastructure/CapMessage.cs

+ 10
- 3
src/DotNetCore.CAP.EntityFrameworkCore/ConsistencyDbContext.cs Wyświetl plik

@@ -24,7 +24,9 @@ namespace DotNetCore.CAP.EntityFrameworkCore
/// <summary>
/// Gets or sets the <see cref="DbSet{ConsistencyMessage}"/> of Messages.
/// </summary>
public DbSet<CapMessage> Messages { get; set; }
public DbSet<CapSentMessage> CapSentMessages { get; set; }

public DbSet<CapReceivedMessage> CapReceivedMessages { get; set; }

/// <summary>
/// Configures the schema for the identity framework.
@@ -34,10 +36,15 @@ namespace DotNetCore.CAP.EntityFrameworkCore
/// </param>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<CapMessage>(b =>
modelBuilder.Entity<CapSentMessage>(b =>
{
b.HasKey(m => m.Id);
b.ToTable("ConsistencyMessages");
b.Property(p => p.StateName).HasMaxLength(50);
});

modelBuilder.Entity<CapReceivedMessage>(b =>
{
b.Property(p => p.StateName).HasMaxLength(50);
});
}
}

+ 1
- 6
src/DotNetCore.CAP/CAP.Options.cs Wyświetl plik

@@ -7,12 +7,7 @@ namespace DotNetCore.CAP.Infrastructure
/// </summary>
public class CapOptions
{
/// <summary>
/// kafka or rabbitMQ brokers connection string.
/// </summary>
public string BrokerUrlList { get; set; } = "localhost:9092";

/// <summary>
/// <summary>
/// Corn expression for configuring retry cron job. Default is 1 min.
/// </summary>
public string CronExp { get; set; } = Cron.Minutely();


+ 1
- 3
src/DotNetCore.CAP/IConsumerClientFactory.cs Wyświetl plik

@@ -9,8 +9,6 @@
/// Create a new instance of <see cref="IConsumerClient"/>.
/// </summary>
/// <param name="groupId"></param>
/// <param name="clientHostAddress"></param>
/// <returns></returns>
IConsumerClient Create(string groupId, string clientHostAddress);
IConsumerClient Create(string groupId);
}
}

+ 1
- 1
src/DotNetCore.CAP/IConsumerHandler.Default.cs Wyświetl plik

@@ -66,7 +66,7 @@ namespace DotNetCore.CAP
{
Task.Factory.StartNew(() =>
{
using (var client = _consumerClientFactory.Create(matchGroup.Key, _options.BrokerUrlList))
using (var client = _consumerClientFactory.Create(matchGroup.Key))
{
client.MessageReceieved += OnMessageReceieved;



+ 4
- 1
src/DotNetCore.CAP/Infrastructure/CapMessage.cs Wyświetl plik

@@ -3,7 +3,7 @@
namespace DotNetCore.CAP.Infrastructure
{
/// <summary>
/// The default implementation of <see cref="ConsistencyMessage{TKey}"/> which uses a string as a primary key.
/// cap messages store model.
/// </summary>
public abstract class CapMessage : MessageBase
{
@@ -36,6 +36,9 @@ namespace DotNetCore.CAP.Infrastructure
public string StateName { get; set; }
}

/// <summary>
/// The message state name.
/// </summary>
public struct StateName
{
public const string Enqueued = nameof(Enqueued);


Ładowanie…
Anuluj
Zapisz