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.

AggregateLifecycle.createNew does not return Entity ID in CommandResultMessage

See original GitHub issue

Basic information

  • Axon Framework version: 4.5.5
  • JDK version: 11

Steps to reproduce

// 1. Sending part:
reactorCommandGateway.send<FooId>(
            CreateFooCommand(
                id = FooId()
            )
)

// 2. Command Handler
class Bar(){
    @CommandHandler
    fun handle(cmd: CreateFooCommand) {
        createNew(Foo::class.java) { Foo(cmd) }
    }
}

Expected behaviour

After Foo’s creation, return FooId in the CommandResultMessage.

Actual behaviour

An empty String is returned.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jasperfectcommented, Dec 23, 2021

Sure, I’ll try my best to shift from Tester to Dev 😃

0reactions
jasperfectcommented, Dec 23, 2021

Hello @abuijze, thanks for the clarification, I got you. AggregateLifecycle.createNew() currently return the aggregate just like its name implies, I like it, but we shouldn’t play with the returned aggregate directly (Bypassing CommandBus) right? So the returned aggregate is pretty much useless? From this perspective, maybe return an ID is safer? 😃 Anyway, below is not ugly either @CommandHandler fun handle(cmd: CreateFooCommand) = createNew(Foo::class.java) { Foo(cmd) }.identifier()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure aggregates in order to return id and version
what is best practice to configure axon framework in spring boot, that all aggregates return their Identifier + Version. after applying a command?...
Read more >
Testing AggregateLifecycle.createNew() when created ...
I am having issues with testing an aggregate that creates another aggregate. @Aggregate class Foo { Id id; Id barId; @CommandHandler void handle ......
Read more >
Index (Axon Framework core 4.0-M2 API) - javadoc.io
Exception indicating that the an entity for an aggregate could not be found. ... Returns the given commandResult as a CommandResultMessage instance.
Read more >
In 2sxc, after an App.Data.Create(), is there a way to get the ...
Create (new record in a different Content-Type). Since .Create() doesn't return anything, what is the best, correct, or elegant way to get to ......
Read more >
Axon 4.4 中文版文档(四) |
负载上用于查找消息应路由到的实体的属性默认为@EntityId注释字段的名称。 ... omitted no-op constructor, command and event sourcing handlers.
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