From 7685a6f2ac58ed854ba50f99208a16524ffda7ce Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Sat, 26 Oct 2024 00:45:29 +0700 Subject: [PATCH] Fix Hyperion serializer config bug (#7364) --- .../HyperionSerializer.cs | 3 +- .../reference.conf | 152 +++++++++--------- 2 files changed, 78 insertions(+), 77 deletions(-) diff --git a/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs b/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs index 2f107d98790..3977556215b 100644 --- a/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs +++ b/src/contrib/serializers/Akka.Serialization.Hyperion/HyperionSerializer.cs @@ -170,7 +170,8 @@ public sealed class HyperionSerializerSettings /// /// Default settings used by when no config has been specified. /// - public static readonly HyperionSerializerSettings Default = Create(HyperionSerializer.DefaultConfiguration()); + public static readonly HyperionSerializerSettings Default = Create(HyperionSerializer.DefaultConfiguration() + .GetConfig("akka.actor.serialization-settings.hyperion")); /// /// Creates a new instance of using provided HOCON config. diff --git a/src/contrib/serializers/Akka.Serialization.Hyperion/reference.conf b/src/contrib/serializers/Akka.Serialization.Hyperion/reference.conf index eccf4724575..1fe54bad3b1 100644 --- a/src/contrib/serializers/Akka.Serialization.Hyperion/reference.conf +++ b/src/contrib/serializers/Akka.Serialization.Hyperion/reference.conf @@ -1,80 +1,80 @@ akka.actor { - serializers { - hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion" - } - serialization-settings { - hyperion { - # If true, hyperion serializer will preserve references between objects. - # This is necessary to support things such as cyclic dependencies between objects. - preserve-object-references = true + serializers { + hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion" + } + serialization-settings { + hyperion { + # If true, hyperion serializer will preserve references between objects. + # This is necessary to support things such as cyclic dependencies between objects. + preserve-object-references = true + + # If true, hyperion serializer will append an information about serialized fields + # to a type manifest. This will increase the payload size of the serialized message, + # but will also allow to provide a limited tolerance to message schema changes + # between actor systems using different assembly versions, making incremental + # cluster updates less restrictive. + version-tolerance = true + + # If disallow-unsafe-type is set to true, hyperion serializer will block potentially + # dangerous and unsafe types from being deserialized during run-time. + # + # Please check this link if you need to read more about this setting: + # https://getakka.net/articles/networking/serialization.html#danger-of-polymorphic-serializer + disallow-unsafe-type = true + + # A fully qualified type name with assembly to a type implementing + # `Akka.Serialization.IKnownTypesProvider` interface, that can be used to supply + # hyperion serializer with a list of types, that are expected to be well-known for + # all communicating parties, effectively reducing a manifests size and serialization + # time. No types are known by default. Implementing class must expose either a default + # constructor or constructor accepting an `ExtendedActorSystem` as its only parameter. + known-types-provider = "Akka.Serialization.NoKnownTypes, Akka.Serialization.Hyperion" - # If true, hyperion serializer will append an information about serialized fields - # to a type manifest. This will increase the payload size of the serialized message, - # but will also allow to provide a limited tolerance to message schema changes - # between actor systems using different assembly versions, making incremental - # cluster updates less restrictive. - version-tolerance = true - - # If disallow-unsafe-type is set to true, hyperion serializer will block potentially - # dangerous and unsafe types from being deserialized during run-time. - # - # Please check this link if you need to read more about this setting: - # https://getakka.net/articles/networking/serialization.html#danger-of-polymorphic-serializer - disallow-unsafe-type = true + # An array of fully qualified class names of types that are allowed to be deserialized + # during run-time. When left as an empty array, type filtering will be disabled. + allowed-types = [] - # A fully qualified type name with assembly to a type implementing - # `Akka.Serialization.IKnownTypesProvider` interface, that can be used to supply - # hyperion serializer with a list of types, that are expected to be well-known for - # all communicating parties, effectively reducing a manifests size and serialization - # time. No types are known by default. Implementing class must expose either a default - # constructor or constructor accepting an `ExtendedActorSystem` as its only parameter. - known-types-provider = "Akka.Serialization.NoKnownTypes, Akka.Serialization.Hyperion" - - # An array of fully qualified class names of types that are allowed to be deserialized - # during run-time. When left as an empty array, type filtering will be disabled. - allowed-types = [] - - # A list of incompatible dll package name for deserializing types - # between NetFx, .NET Core, and the new .NET - # Used to map and rename/correct different dll names between different platforms - # in the .NET ecosystem. - # - # How it works is that when the serializer detects that the type name contains - # the fingerprint string, it will replace the string declared in the rename-from - # property into the string declared in the rename-to property. - # - # if(packageName.Contains(fingerprint)) packageName = packageName.Replace(rename-from, rename-to); - # - # The commented values below are the default values used in the serializer, - # provided as an example on how to use this feature. - cross-platform-package-name-overrides = { - # netfx = [ - # { - # fingerprint = "System.Private.CoreLib,%core%", - # rename-from = "System.Private.CoreLib,%core%", - # rename-to = "mscorlib,%core%" - # }] - # netcore = [ - # { - # fingerprint = "mscorlib,%core%", - # rename-from = "mscorlib,%core%", - # rename-to = "System.Private.CoreLib,%core%" - # }] - # net = [ - # { - # fingerprint = "mscorlib,%core%", - # rename-from = "mscorlib,%core%", - # rename-to = "System.Private.CoreLib,%core%" - # }] - } - - # An array of fully qualified class names of classes inheriting Hyperion.Surrogate class. - # These classes will be used to transform one complex class into another much simpler class - # that are more suitable for over the wire transport. - # - # Please refer to https://getakka.net/articles/networking/serialization.html#complex-object-serialization-using-hyperion - # for more information. - surrogates = [] - } - } + # A list of incompatible dll package name for deserializing types + # between NetFx, .NET Core, and the new .NET + # Used to map and rename/correct different dll names between different platforms + # in the .NET ecosystem. + # + # How it works is that when the serializer detects that the type name contains + # the fingerprint string, it will replace the string declared in the rename-from + # property into the string declared in the rename-to property. + # + # if(packageName.Contains(fingerprint)) packageName = packageName.Replace(rename-from, rename-to); + # + # The commented values below are the default values used in the serializer, + # provided as an example on how to use this feature. + cross-platform-package-name-overrides = { + # netfx = [ + # { + # fingerprint = "System.Private.CoreLib,%core%", + # rename-from = "System.Private.CoreLib,%core%", + # rename-to = "mscorlib,%core%" + # }] + # netcore = [ + # { + # fingerprint = "mscorlib,%core%", + # rename-from = "mscorlib,%core%", + # rename-to = "System.Private.CoreLib,%core%" + # }] + # net = [ + # { + # fingerprint = "mscorlib,%core%", + # rename-from = "mscorlib,%core%", + # rename-to = "System.Private.CoreLib,%core%" + # }] + } + + # An array of fully qualified class names of classes inheriting Hyperion.Surrogate class. + # These classes will be used to transform one complex class into another much simpler class + # that are more suitable for over the wire transport. + # + # Please refer to https://getakka.net/articles/networking/serialization.html#complex-object-serialization-using-hyperion + # for more information. + surrogates = [] + } + } } \ No newline at end of file