I have a console app within which you can specify the parameters, depending on the specified parameter, different handlers will load. For example:
prgm.exe nyse prgm.exe nasdaq
The goal is that in my code I have InyseHandlers
And the Inside Handlers
and in the first case only any handlers are loaded in advance, similarly for the case of the latter. The goal is to be a program, depending on how it is run, can listen to different or all sources. To get this, I have installed my interfaces as mentioned above. Then set up in my configuration:
var configuration = new bus configuration (); Configuration.InitializeStepBusConventions (); // Extension method, no problem // Load all the handlers specified in the command line argument (! Args.Contains ("any") and Args.Length! = 0) {list & lt; Type & gt; Handlerload = new list & lt; Type & gt; (); Foreach (argument in args) {Console.WriteLine ("Adding Clients to Loaded Handlers ...", Logic.Tupper ()); Switch (logic) {case "nyse": AddToHandlerList (handlertoolload, typef (INyseProcessor)); break; Case "Nasdaq": AddToHandlerList (HandlerToldload, TypeF (InsadProcessor)); break; }} Configuration. Typeshotcan (handlerload); } Configuration. Euskentner & lt; NinjectBuilder & gt; (C => c.ExistingKernel (kernel)); Configuration.EndPoint (ConfigurationManager.AppSettings [Default.Project.DefaultEndPointName]); NServiceBus.Logging.LogManager.Use & LT; NLogFactory & gt; (); Bus.Create (configuration) .start ();
and where:
Private Zero AddToHandlerList (list handlerSoload, type interface type) {list & lt; Type & gt; ClassesWhichExtendInterface = Assembly.GetExecutingAssembly (). GetTypes () Where (t = & gt; interface type. IssaGonfal Fm (t)). ToList (); ClassesWhichExtendInterface.Remove (interfaceType); HandlersToLoad.AddRange (classesWhichExtendInterface); }
Types are loaded as expected, so the list
is fine but when I run it and just In the Start
line, I get the following error:
The key given was not present in the dictionary (NSISBBS.LocalEdress) dictionary.
Without type loading, the default behavior works fine and all the processors are loaded within the assembly. Why am I getting this error after running the typesToScan ()
line?
Edit: The extension method here is:
config.UseSerialization & lt; JsonSerializer & gt; (); Config.UseTransport & LT; RabbitMQTransport & gt; (); Config.UsePersistence & LT; InMemoryPersistence & gt; (); Config.EnableInstallers (); Return configuration;
Your exception is here
localAddress = Address .Parse (Settings.Get & lt; String & gt; ("NServiceBus.LocalAddress"));
The setting is determined by a transport by the "NSIRBBS.Local adapter" kppp. Since you are not using "core" transport (MSMQ), I suspect that your transport assembly type needs to be included in the typewrite scan, due to:
ForAllTypes & lt; Feature & gt; (TypesToScan, T => FeatureActivator.Add (T. Constrict & Lt; Feature & gt; ());
I had a similar problem with the use of SQL Server Transportation, when I send a list to assemblies (assemblies) and there does not include the NSCRAS assemblies, the transport starts Failed to do As soon as I added NSverbis. * Legislatures, everything started to work.
No comments:
Post a Comment