[Bug] Deserialization of IntegrationEvent
See original GitHub issuePossible Issue
Deserialization of IntegrationEvent
based classes won’t assign the same Id
and CreationDate
properties of the published events.
Example
From my understanding based on the current implementation of the IntegrationEvent
those properties being { get; }
only will not be populated by the current deserialization provided by the event bus implementations (AzureServiceBus and RabbitMQ) but instead get new values based on the constructor (issue link on Newtonsoft.Json project).
IntegrationEvent snippet
public class IntegrationEvent
{
public IntegrationEvent()
{
Id = Guid.NewGuid();
CreationDate = DateTime.UtcNow;
}
public Guid Id { get; }
public DateTime CreationDate { get; }
}
deserialization snippet
var integrationEvent = JsonConvert.DeserializeObject(message, eventType);
Question
Is this an unintended behavior (bug) or an integration event is by design supposed to have a new Id
and CreationDate
whenever it gets within the context of a microservice (subscriber)?.
– Best regards, Diogo Pinho
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Deserialization Bugs in the Wild
Insecure deserialization is a type of vulnerability that arises when an attacker is able to manipulate the serialized object and cause ...
Read more >SDK Documentation Explorer
Developer-focused guides, tutorials, API Documentation, videos, and more for Genesys Cloud.
Read more >Events not working with after Deserialization
What's happening is that the deserialized object no longer has the handler attached. You cannot serialize or deserialize event handlers; at the ...
Read more >All Classes (Spring Integration 5.5.11 API)
A strategy to build an ErrorMessage based on the provided Throwable and AttributeAccessor as a context. ErrorMessageUtils. Utilities for building error messages ...
Read more >Function error logged - ERP 10
This simple deserializes a string which looks something like this depending on the order submitted: "productList": "[\r\n{\"PartNum\": \" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Diggzinc, this is actually a bug.
We intent to fix it this way to minimize changes and still keep the class immutable (in practice) and also “extend” this “immutability” implementation to the derived events:
This solves the issue from the deserializer perspective, as it can find its way through the private setter, but has to be tested in the real app to be sure it works as expected.
Hope this helps in the meantime.
Closing this issue as it was solved with commit 06de1b68e3a758c854084200924c7e0799aa8b53