Skip to content
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
@bruno-brant

Description

@bruno-brant

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:

https://github.com/Avanade/Liquid-Application-Framework/blob/ac834f46809cd445dda8783ff616ea4ae7af6b33/src/Liquid.Activation/Worker/LightWorker.cs#L38-L45

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
{
    // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomplexity:highThe complexity of the issue is highsize:smallThe size of the issue is small

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions