I installed in the Domain project EasyAbp.NotificationService.Domain and EasyAbp.NotificationService.Provider.Mailing packages, and introduced in DomainModule module:
The code follows the source code example to write the test:
However, the console did report the following error and did not execute the subscription event:
Detailed error message:
---> (Inner Exception #4) System.FormatException: Could not deserialize JSON text: '{"$type":"EasyAbp.NotificationService.Provider.Mailing.CreateEmailNotificationEto, EasyAbp.NotificationService.Provider.Mailing.Abstractions","Subject":"test","Body":"","TenantId":null,"UserIds":{"$type":"System.Collections.Generic.List
1[[System.Guid, System.Private.CoreLib]], System.Private.CoreLib","$values":["1a5d39c8-2822-42e0-a92e-39fae1a6a4ab"]}}'
---> Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type EasyAbp.NotificationService.Provider.Mailing.CreateEmailNotificationEto. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'Subject', line 1, position 152.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type)
--- End of inner exception stack trace ---
at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type)
at Rebus.Serialization.Json.JsonSerializer.GetMessage(TransportMessage transportMessage, Encoding bodyEncoding)
at Rebus.Serialization.Json.JsonSerializer.Deserialize(TransportMessage transportMessage)
at Rebus.Compression.UnzippingSerializerDecorator.Deserialize(TransportMessage transportMessage)
at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func1 next) at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func
1 next)
at Rebus.Retry.FailFast.FailFastStep.Process(IncomingStepContext context, Func1 next) at Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(Func
1 next, String identifierToTrackMessageBy, ITransactionContext transactionContext, String messageId, String secondLevelMessageId)<---
`
Add error messages when using SMS for testing:
---> (Inner Exception #4) System.FormatException: Could not deserialize JSON text: '{"$type":"EasyAbp.NotificationService.Provider.Sms.CreateSmsNotificationEto, EasyAbp.NotificationService.Provider.Sms.Abstractions","Text":"test","Properties":{"$type":"System.Collections.Generic.Dictionary
2[[System.String, System.Private.CoreLib],[System.Object, System.Private.CoreLib]], System.Private.CoreLib","MyProperty":"123456"},"TenantId":null,"UserIds":{"$type":"System.Collections.Generic.List1[[System.Guid, System.Private.CoreLib]], System.Private.CoreLib","$values":["1a5d39c8-2822-42e0-a92e-39fae1a6a4ab"]}}' ---> Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type EasyAbp.NotificationService.Provider.Sms.CreateSmsNotificationEto. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'Text', line 1, position 139. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type) --- End of inner exception stack trace --- at Rebus.Serialization.Json.JsonSerializer.Deserialize(String bodyString, Type type) at Rebus.Serialization.Json.JsonSerializer.GetMessage(TransportMessage transportMessage, Encoding bodyEncoding) at Rebus.Serialization.Json.JsonSerializer.Deserialize(TransportMessage transportMessage) at Rebus.Compression.UnzippingSerializerDecorator.Deserialize(TransportMessage transportMessage) at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func
1 next)
at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func1 next) at Rebus.Retry.FailFast.FailFastStep.Process(IncomingStepContext context, Func
1 next)
at Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(Func1 next, String identifierToTrackMessageBy, ITransactionContext transactionContext, String messageId, String secondLevelMessageId)<---