question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deadline cannot fire when created in "polymorphic aggregate"

See original GitHub issue

Basic 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:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelbubcommented, Mar 31, 2022

To get around this particular problem without changing how serialization is configured:

interface AggregateScopeDescriptorMixIn {
        @JsonProperty("identifier")
        Object getIdentifier();
 }

and

objectMapper.addMixIn(AggregateScopeDescriptor.class, AggregateScopeDescriptorMixIn.class);

1reaction
michaelbubcommented, Mar 30, 2022

It’s the .withGetterVisibility(Visibility.PUBLIC_ONLY) setting in the ObjectMapper. We have basically disabled getters for serialization which has always worked until AggregateScopeDescriptor came along. When the constructor with the Supplier is used to create the AggregateScopeDescriptor, serialization in fields-only mode is not an option.

Closing this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Aggregate Polymorphism - Axon Reference Guide
Aggregate Polymorphism · It is not allowed to have a constructor annotated with · Having creational command handlers of the same command name...
Read more >
7 Defining Polymorphic View Objects - Oracle Help Center
This chapter describes how to use inheritance in ADF Business Components to create an ADF view object that exposes multiple view row types...
Read more >
ActivityHistory | Object Reference for the Salesforce Platform
Type: dateTime; Properties: Aggregate, Filter, Nillable, Sort; Description: Contains the event's due date if the IsAllDayEvent flag is set to false .
Read more >
If everyone hates it, why is OOP still so widespread?
Object oriented programming tends to use a lot of subtyping polymorphism and ad-hoc polymorphism, but again, this is not a concept limited to ......
Read more >
HyperSQL User Guide - HSQLDB
The Servlet Mode cannot be started independently from the servlet engine. ... Some SQL functions used within SQL statements are polymorphic, but the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found