Je suis encore novice dans le domaine des axones.Implémentation de Snapshot dans AXON 3.0: Le type d'agrégation est inconnu dans ce snapShotter
Je suis en train de mettre en œuvre d'instantanés à l'aide mongodb dans ma demande et je continue à obtenir une erreur en disant
"AbstractSnapshotter: Une tentative de créer et stocker un instantané a donné lieu à une exception sommaire d'exception:. Type d'agrégat est inconnu dans cet instantané: com.myworklife.contacts.domain.contact.Contact "
Ceci est une partie de mon fichier de configuration java.
@Bean
public AggregateSnapshotter snapShotter(EventStore eventStore, AggregateFactory<Contact> contactAggregateFactory) {
return new AggregateSnapshotter(eventStore);
}
@Bean
public SnapshotTriggerDefinition snapshotTriggerDefinition(Snapshotter snapShotter) throws Exception {
return new EventCountSnapshotTriggerDefinition(snapShotter, 1);
}
@Bean
public EventStore eventStore(EventStorageEngine eventStorageEngine) {
return new EmbeddedEventStore(eventStorageEngine);
}
@Bean
public Repository<Contact> contactAggregateRepository(EventStore eventStore, SnapshotTriggerDefinition snapshotTriggerDefinition) {
return new ContactRepository(eventStore, snapshotTriggerDefinition);
}
Et mon référentiel.
@Repository("ContactRepository")
public class ContactRepository extends EventSourcingRepository<Contact> {
@Autowired
public ContactRepository(EventStore eventStore, SnapshotTriggerDefinition snapshotTriggerDefinition) {
super(Contact.class, eventStore, snapshotTriggerDefinition);
}
public Contact findContact(ContactId contactId) {
return load(contactId.toString()).getWrappedAggregate().getAggregateRoot();
}
}
Mon agrégat.
@Aggregate(repository="contactAggregateRepository")
public class Contact {
@AggregateIdentifier
private ContactId id;
private String name;
private String mobileNumber;
public Contact() {
// do nothing, Axon requires default constructor
}
@CommandHandler
public Contact(CreateContactCommand createContactCommand) {
apply(new ContactHasBeenCreatedEvent(createContactCommand.getContactId(), createContactCommand.getName(),
createContactCommand.getMobileNumber()));
}
}
Y at-il quelque chose que je fais mal? .
depuis que je reçois une erreur "Une tentative de créer et de stocker un instantané a donné lieu à une exception sommaire d'exception: Type d'agrégat est inconnue dans ce Snapshotter: com.myworklife.contacts.domain.contact.Contact "
Toute aide sera grandement appréciée.
Merci, Pat