JasperFx / wolverine

Supercharged .NET server side development!
https://wolverinefx.net
MIT License
1.25k stars 137 forks source link

When I use DisableConventionalDiscovery() CustomizeHandlerDiscovery doesn't work #839

Closed zeryk24 closed 6 months ago

zeryk24 commented 6 months ago

Describe the bug DisableConventionalDiscovery() method on wolverine options also disables includes and excludes in CustomizeHandlerDiscovery() which is not desired behaviour in my opinion.

Expected behavior When I disable conventional discovery I still want it to use my custom discovery which I specified in CustomizeHandlerDiscovery()

Additional context I can create some pull request if it's really a bug

jeremydmiller commented 6 months ago

What are you even trying to do? I can't imagine why that would be a valid combination of inputs if you're turning off the conventional discovery altogether. What exactly are you trying to do?

zeryk24 commented 6 months ago

My handlers implements my own interface. I want to disable default discovery (based on naming conventions, attributes etc.) and discover them only by implementing my interface. I found this in documentation: image so I called DisableConventionalDiscovery() method and in CustomizeHandlerDiscovery I included types, that implements my interface.

The reason behind is that we are using our own (legacy) mediator implementation which is not very good in my opinion, so I am trying to do PoC with wolverine using our old interfaces for messages and handlers.

jeremydmiller commented 6 months ago

Why don't you leave the conventional discovery on, because when you turn it off, you're disabling all assembly scanning. The Customize() stuff is all additive, so do that. Or there are attributes and Wolverine marker interfaces for discovery as well

zeryk24 commented 6 months ago

I did in the end, but I think that would be beneficial to be able to choose just one type of discovery, because especially on big projects where more than one team works on one code base its hard to keep consistency in the code. Of course you can create some architectural tests etc. but it would be easier if you could just select some type when setuping wolverine.

Or at least you should change that title and code snippet in documentation in my opinion, because from it that looks like you are able to do that the way I did it. (The "worker" and "listener" suffix won't work in that code)

jeremydmiller commented 6 months ago

We can add some explanatory text in the docs. In the end, I think there was a misinterpretation of the functionality