Commit 8bfd066f authored by Savorboard's avatar Savorboard

add get all topics

parent b418aeb5
......@@ -2,13 +2,13 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using DotNetCore.CAP.Abstractions;
namespace DotNetCore.CAP.Internal
{
internal class MethodMatcherCache
{
private readonly IConsumerServiceSelector _selector;
private List<string> _allTopics;
public MethodMatcherCache(IConsumerServiceSelector selector)
{
......@@ -54,5 +54,27 @@ namespace DotNetCore.CAP.Internal
}
return dic;
}
/// <summary>
/// Get all subscribe topics name.
/// </summary>
public IEnumerable<string> GetSubscribeTopics()
{
if (_allTopics != null)
{
return _allTopics;
}
if (Entries == null)
throw new ArgumentNullException(nameof(Entries));
_allTopics = new List<string>();
foreach (var descriptors in Entries.Values)
{
_allTopics.AddRange(descriptors.Select(x => x.Attribute.Name));
}
return _allTopics;
}
}
}
\ No newline at end of file
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