Deadline cannot fire when created in "polymorphic aggregate"
See original GitHub issueBasic information
- Axon Framework version: 4.4.3
- JDK version: openjdk version “11.0.3” 2019-04-16 LTS
Please see code example in https://github.com/AxonFramework/AxonFramework/issues/2162. Using the aggregates A, B, C, each one has @Aggregate.
In B I create a deadline which when tested in unit-tests etc. is fine. In an integrationt test (then using QuartzDeadlineManager
BTW, which could be part of the issue) it does not work. I use a method in DeadlineManager
that calls Scope.describeCurrentScope()
by itself. The resulting AggregateScopeDescriptor
is created by using the Supplier<Object> identifierSupplier
type of constructor (debugged this using the unit-test, assuming it’s always the same?). Looks like the AggregateScopeDescriptor
is later serialized without ever calling AggregateScopeDescriptor.getIdentifier()
so the identifier
property is always null.
Finally this gives an error like this: “Failed to send a DeadlineMessage for scope [AggregateScopeDescriptor for type [A] and identifier [null]]”
Given my previous problems with the polymorphic aggregates I first was irritated by the “type [A]” part. Was expecting B really, but then again I know too little about what these scopes do.
I worked around this problem by providing my own AggregateScopeDescriptor
for the DeadlineManager
which has the identifier
already set.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
To get around this particular problem without changing how serialization is configured:
and
objectMapper.addMixIn(AggregateScopeDescriptor.class, AggregateScopeDescriptorMixIn.class);
It’s the
.withGetterVisibility(Visibility.PUBLIC_ONLY)
setting in theObjectMapper
. We have basically disabled getters for serialization which has always worked until AggregateScopeDescriptor came along. When the constructor with theSupplier
is used to create theAggregateScopeDescriptor
, serialization in fields-only mode is not an option.Closing this