Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow passing wrong entity state kind #1548

Open
3 tasks
alexander-yevsyukov opened this issue Apr 16, 2024 · 1 comment
Open
3 tasks

Do not allow passing wrong entity state kind #1548

alexander-yevsyukov opened this issue Apr 16, 2024 · 1 comment

Comments

@alexander-yevsyukov
Copy link
Contributor

alexander-yevsyukov commented Apr 16, 2024

Now it is possible to declare an entity class with an entity state of a wrong kind. For example, it is possible to create a Projection with a message implementing EntityState which has the following option declaration:

option (.entity) = { kind: PROCESS_MANAGER visibility: QUERY };

Although, it does not do any harm, it's obviously a programming error. This is not what the developer intended. Moreover, keeping such errors unnoticed prevents us from introducing specific interfaces for entity states for projections, process managers, and aggregates.

Suggested actions

  • 1. Introduce ProjectionState, ProcessManagerState, and AggregateState interfaces which implement EntityState.
  • 2. Update code generation to use new interfaces from the item 3 above.
  • 3. Require specific entity state interfaces in Projection, ProcessManager, and Aggregate classes.
@armiol
Copy link
Contributor

armiol commented Apr 16, 2024

@alexander-yevsyukov I would go with pp. 3 and 4.

Points no.1 and no.2 do not lead to a compilation failure, which we ideally want. And they may be both expensive and restrictive in terms of GraalVM compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants