@Retention(value=RUNTIME) @Target(value=METHOD) public @interface AppStateFactoryAccessor
This annotation can be used on a single method of the application main entry point class. Example: Providing the application root state object.
@AppHAPolicy(HAPolicy.StateReplication)
public class MyApp {
@AppStateFactoryAccessor
final public IAepApplicationStateFactory getStateFactory() {
return new IAepApplicationStateFactory() {
@Override
final public Repository createState(MessageView view) {
return Repository.create();
}
};
}
@EventHandler
public void addCustomer(CreateCustomerMessage message, Repository repository) {
Customer customer = Customer.create();
customer.setProfile(message.getCustomerProfile().copy());
repository.put(message.getCustomerId(), customer);
}
}
Copyright © 2019 Neeve Research, LLC. All Rights Reserved.