diff --git a/PettingZoo.Core/Generator/IExampleGenerator.cs b/PettingZoo.Core/Generator/IExampleGenerator.cs index f8fdf44..b39e313 100644 --- a/PettingZoo.Core/Generator/IExampleGenerator.cs +++ b/PettingZoo.Core/Generator/IExampleGenerator.cs @@ -17,11 +17,13 @@ namespace PettingZoo.Core.Generator public interface IClassTypeExample : IExample { - public string AssemblyName { get; } - public string? Namespace { get; } - public string ClassName { get; } + string AssemblyName { get; } + string? Namespace { get; } + string ClassName { get; } - public string FullClassName => (!string.IsNullOrEmpty(Namespace) ? Namespace + "." : "") + ClassName; + string FullClassName => (!string.IsNullOrEmpty(Namespace) ? Namespace + "." : "") + ClassName; + + bool TryGetPublishDestination(out string exchange, out string routingKey); } diff --git a/PettingZoo.Tapeti/AssemblyParser/AssemblyParser.cs b/PettingZoo.Tapeti/AssemblyParser/AssemblyParser.cs index 50c5168..14be17f 100644 --- a/PettingZoo.Tapeti/AssemblyParser/AssemblyParser.cs +++ b/PettingZoo.Tapeti/AssemblyParser/AssemblyParser.cs @@ -7,6 +7,7 @@ using System.Runtime.Loader; using Newtonsoft.Json; using PettingZoo.Core.Generator; using PettingZoo.Core.Validation; +using Tapeti.Default; namespace PettingZoo.Tapeti.AssemblyParser { @@ -83,6 +84,24 @@ namespace PettingZoo.Tapeti.AssemblyParser } + public bool TryGetPublishDestination(out string exchange, out string routingKey) + { + try + { + // Assume default strategies are used + exchange = new NamespaceMatchExchangeStrategy().GetExchange(type); + routingKey = new TypeNameRoutingKeyStrategy().GetRoutingKey(type); + return true; + } + catch + { + exchange = ""; + routingKey = ""; + return false; + } + } + + public bool CanValidate() { return InitializeValidation(); diff --git a/PettingZoo.Tapeti/PettingZoo.Tapeti.csproj b/PettingZoo.Tapeti/PettingZoo.Tapeti.csproj index 3bf7adf..68c879d 100644 --- a/PettingZoo.Tapeti/PettingZoo.Tapeti.csproj +++ b/PettingZoo.Tapeti/PettingZoo.Tapeti.csproj @@ -17,6 +17,7 @@ + diff --git a/PettingZoo.Tapeti/UI/ClassSelection/ClassSelectionViewModel.cs b/PettingZoo.Tapeti/UI/ClassSelection/ClassSelectionViewModel.cs index 51f8623..f17c497 100644 --- a/PettingZoo.Tapeti/UI/ClassSelection/ClassSelectionViewModel.cs +++ b/PettingZoo.Tapeti/UI/ClassSelection/ClassSelectionViewModel.cs @@ -300,6 +300,14 @@ namespace PettingZoo.Tapeti.UI.ClassSelection { return ""; } + + + public bool TryGetPublishDestination(out string exchange, out string routingKey) + { + exchange = ""; + routingKey = ""; + return false; + } } } } diff --git a/PettingZoo.WPF/Style.xaml b/PettingZoo.WPF/Style.xaml index 96fa4f5..4a53851 100644 --- a/PettingZoo.WPF/Style.xaml +++ b/PettingZoo.WPF/Style.xaml @@ -67,6 +67,12 @@ + +