In CQRS, if a saga (or more precisely a process manager according to the CQRS Journey book) sends out a new command to change aggregates how can I ensure that this command is not possible to send from anywhere else (e.g. by a programmer on UI part). That is the command is only for "internal" usage of the saga?
How to handle a situation, where the command is "private" for the saga only.
I am writing an app in Java with Axon framework. But this can be related to any implementation (even in C#).
I came up with only one solution - store the command class file in saga's package and make the class's constructor package-private. Thus only saga can instantiate the command. I cannot make the whole class private because it must be visible from aggregate's command handlers.
Is there any better way?