Bugfixes for heartbeats using MongoDB #5337
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using Elsa with MongoDB we encountered two errors during the heartbeat functionality.
The first error was:
System.ArgumentException: Instance property 'Id' is not defined for type 'Elsa.KeyValues.Entities.SerializedKeyValuePair' (Parameter 'propertyName')
inElsa.Hosting.Management.HostedServices.InstanceHeartbeatService
.Here the
Elsa.MongoDb.Modules.Runtime.MongoKeyValueStore
tries to save a SerializedKeyValuePair instance using an ID filter, but SerializedKeyValuePair does not have this property.Only the other entities do have an ID property through the Entity base class.
I specified a key selector.
The second error was:
System.FormatException: Element '_id' does not match any field or property of class Elsa.KeyValues.Entities.SerializedKeyValuePair.
inElsa.Hosting.Management.HostedServices.InstanceHeartbeatMonitorService
.This time MongoDB could not load the SerializedKeyValuePair instances, because no mapping for the missing ID property could be found.
I added a BISON mapping to ignore not mappable fields.