akkadotnet / akka.net

Canonical actor model implementation for .NET with local + distributed actors in C# and F#.
http://getakka.net
Other
4.69k stars 1.04k forks source link

Akka.Streams GraphStage.InitialAttributes is injected to the end of the Module.Attributes #5388

Open Arkatufus opened 2 years ago

Arkatufus commented 2 years ago

Version Information Version of Akka.NET? 1.4.28 Which Akka.NET Modules? Akka.Streams

Describe the bug When set, GraphStage.InitialAttributes is appended to the tail of Module.Attributes instead of the head

To Reproduce Steps to reproduce the behavior: https://github.com/akkadotnet/akka.net/pull/5387

Expected behavior You should be able to override GraphStage.InitialAttributes using the fluent API .WithAttributes and .AddAttributes

Actual behavior GraphStage.InitialAttributes is appended to the end of the list instead

Environment Windows 10, all .NET platform

Aaronontheweb commented 2 years ago

Are we supposed to only allow one Attribute of a given type per graph stage? I'm not sure what the spec here is on that. I had always assumed you could replace / override the defaults by calling additional WithAttributes invocations.

Arkatufus commented 2 years ago

There can be multiple of a single type in the Attributes class, its just a simple list of attributes, but only the last one on the list counts as the final attribute. The idea is to keep appending attributes to the list and grab the .LastOrDefault from it.