Axonframework: Query Repository for presence of Aggregate Identifier

Created on 9 Jul 2018  路  2Comments  路  Source: AxonFramework/AxonFramework

It would be beneficial if the Repository interface would contain an API call to verify whether a given 'aggregate identifier' is already present for the given Aggregate.

Such a feature would alleviate users from the following use case fore example:

  • Publish a aggregate-creation command with a given aggregate identifier, which might already exist
  • Aggregate identifier exists, hence aggregate-creation command handling fails
  • Users needs to catch this exception and know to re-publish the given command with a different aggregate identifier
  • Repeat until successful
Could Duplicate Obsolete Feature

Most helpful comment

Maybe idempotent aggregate creation could be a feature of the command bus ? If enabled, it would ignore the PK violation upon aggregate insert, because that's really the only way to know if the aggregate already exists or not. The repository API call is nice but it doesn't give you any guarantees, it AR could be created just after...

All 2 comments

Maybe idempotent aggregate creation could be a feature of the command bus ? If enabled, it would ignore the PK violation upon aggregate insert, because that's really the only way to know if the aggregate already exists or not. The repository API call is nice but it doesn't give you any guarantees, it AR could be created just after...

This issue was in essence created to support a create or update approach when it comes to an Aggregate's command handler.

Is such, it's (firstly) a duplicate of #681, but more importantly it's thus already superseded by the implementation built in pull request #1281.

Due to this, I will be closing this issue as "duplicate" and "obsolete".

Was this page helpful?
0 / 5 - 0 ratings