Savorboard пре 7 година
родитељ
комит
5c82ba1d7e
5 измењених фајлова са 10 додато и 12 уклоњено
  1. +2
    -3
      src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs
  2. +1
    -1
      src/DotNetCore.CAP/IConsumerHandler.Default.cs
  3. +3
    -3
      src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs
  4. +2
    -3
      src/DotNetCore.CAP/Internal/MethodMatcherCache.cs
  5. +2
    -2
      test/DotNetCore.CAP.Test/ConsumerServiceSelectorTest.cs

+ 2
- 3
src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs Прегледај датотеку

@@ -11,10 +11,9 @@ namespace DotNetCore.CAP.Abstractions
/// <summary> /// <summary>
/// Selects a set of <see cref="ConsumerExecutorDescriptor"/> candidates for the current message associated with /// Selects a set of <see cref="ConsumerExecutorDescriptor"/> candidates for the current message associated with
/// <paramref name="provider"/>. /// <paramref name="provider"/>.
/// </summary>
/// <param name="provider"> <see cref="IServiceProvider"/>.</param>
/// </summary>
/// <returns>A set of <see cref="ConsumerExecutorDescriptor"/> candidates or <c>null</c>.</returns> /// <returns>A set of <see cref="ConsumerExecutorDescriptor"/> candidates or <c>null</c>.</returns>
IReadOnlyList<ConsumerExecutorDescriptor> SelectCandidates(IServiceProvider provider);
IReadOnlyList<ConsumerExecutorDescriptor> SelectCandidates();


/// <summary> /// <summary>
/// Selects the best <see cref="ConsumerExecutorDescriptor"/> candidate from <paramref name="candidates"/> for the /// Selects the best <see cref="ConsumerExecutorDescriptor"/> candidate from <paramref name="candidates"/> for the


+ 1
- 1
src/DotNetCore.CAP/IConsumerHandler.Default.cs Прегледај датотеку

@@ -47,7 +47,7 @@ namespace DotNetCore.CAP


public void Start() public void Start()
{ {
var groupingMatchs = _selector.GetCandidatesMethodsOfGroupNameGrouped(_serviceProvider);
var groupingMatchs = _selector.GetCandidatesMethodsOfGroupNameGrouped();


foreach (var matchGroup in groupingMatchs) foreach (var matchGroup in groupingMatchs)
{ {


+ 3
- 3
src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs Прегледај датотеку

@@ -33,13 +33,13 @@ namespace DotNetCore.CAP.Internal
return executeDescriptor.FirstOrDefault(x => x.Attribute.Name == key); return executeDescriptor.FirstOrDefault(x => x.Attribute.Name == key);
} }


public IReadOnlyList<ConsumerExecutorDescriptor> SelectCandidates(IServiceProvider provider)
public IReadOnlyList<ConsumerExecutorDescriptor> SelectCandidates()
{ {
var executorDescriptorList = new List<ConsumerExecutorDescriptor>(); var executorDescriptorList = new List<ConsumerExecutorDescriptor>();


executorDescriptorList.AddRange(FindConsumersFromInterfaceTypes(provider));
executorDescriptorList.AddRange(FindConsumersFromInterfaceTypes(_serviceProvider));


executorDescriptorList.AddRange(FindConsumersFromControllerTypes(provider));
executorDescriptorList.AddRange(FindConsumersFromControllerTypes(_serviceProvider));


return executorDescriptorList; return executorDescriptorList;
} }


+ 2
- 3
src/DotNetCore.CAP/Internal/MethodMatcherCache.cs Прегледај датотеку

@@ -22,12 +22,11 @@ namespace DotNetCore.CAP.Internal
/// Get a dictionary of candidates.In the dictionary, /// Get a dictionary of candidates.In the dictionary,
/// the Key is the CAPSubscribeAttribute Group, the Value for the current Group of candidates /// the Key is the CAPSubscribeAttribute Group, the Value for the current Group of candidates
/// </summary> /// </summary>
/// <param name="provider"><see cref="IServiceProvider"/></param>
public ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>> GetCandidatesMethodsOfGroupNameGrouped(IServiceProvider provider)
public ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>> GetCandidatesMethodsOfGroupNameGrouped()
{ {
if (Entries.Count != 0) return Entries; if (Entries.Count != 0) return Entries;


var executorCollection = _selector.SelectCandidates(provider);
var executorCollection = _selector.SelectCandidates();


var groupedCandidates = executorCollection.GroupBy(x => x.Attribute.Group); var groupedCandidates = executorCollection.GroupBy(x => x.Attribute.Group);




+ 2
- 2
test/DotNetCore.CAP.Test/ConsumerServiceSelectorTest.cs Прегледај датотеку

@@ -25,7 +25,7 @@ namespace DotNetCore.CAP.Test
public void CanFindAllConsumerService() public void CanFindAllConsumerService()
{ {
var selector = _provider.GetRequiredService<IConsumerServiceSelector>(); var selector = _provider.GetRequiredService<IConsumerServiceSelector>();
var candidates = selector.SelectCandidates(_provider);
var candidates = selector.SelectCandidates();


Assert.Equal(2, candidates.Count); Assert.Equal(2, candidates.Count);
} }
@@ -34,7 +34,7 @@ namespace DotNetCore.CAP.Test
public void CanFindSpecifiedTopic() public void CanFindSpecifiedTopic()
{ {
var selector = _provider.GetRequiredService<IConsumerServiceSelector>(); var selector = _provider.GetRequiredService<IConsumerServiceSelector>();
var candidates = selector.SelectCandidates(_provider);
var candidates = selector.SelectCandidates();
var bestCandidates = selector.SelectBestCandidate("Candidates.Foo", candidates); var bestCandidates = selector.SelectBestCandidate("Candidates.Foo", candidates);


Assert.NotNull(bestCandidates); Assert.NotNull(bestCandidates);


Loading…
Откажи
Сачувај