This repository was archived by the owner on Aug 18, 2021. It is now read-only.
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
LightWorker accepts *any* attribute in the place of MessageBusAttribute #195
Open
Description
In order to use LiquidWorker
, you need to annotate the class with an attribute - usually MessageBusAttribute
. However, what we discovered is that the code that attempts to find the attribute, well, accepts any attribute:
As you can see, the code gets all attributes (ReflectedType.CustomAttributes
) and, if there's any, then it gets the first, and uses the first attribute as the tag name... whatever it is. And, of course, the code will break if there's no attributes.
So, while this is what is expected...
[MessageBus("BusNameInConfig")]
public class MyWorker : ILightWorker
{
}
...this is also acceptable...
[Obsolete("BusTag")]
public class Worker : ILightWorker
{
// ...
}
...and this will fail:
[Obsolete, MessageBus("BusTag")]
public class Worker : ILightWorker
{
// ...
}