I am trying to use the Axon Framework inside Apache Karaf.
During the configuration of the Axon Framework I want to setup a
JpaTokenStore which requires an EntityManager.
Configurer configurer = DefaultConfigurer.defaultConfiguration()
.configureAggregate(MyAggregate.class)
.eventProcessing(eventProcessingConfigurer -> {
eventProcessingConfigurer.registerTokenStore(configuration ->
JpaTokenStore.builder()
.entityManagerProvider(new
SimpleEntityManagerProvider(*entityManager*))
.serializer(configuration.serializer())
.build()
);
}
);
Whenever I provide an EntityManager I keep getting this error:
java.lang.IllegalStateException: Need active coordination. I know it is
because the injected entity manager is used outside of the class it is
injected into.
One of the guys from Axon suggested that I use a TransactionManager similar
to this one
(https://github.com/AxonFramework/AxonFramework/blob/master/spring/src/main/java/org/axonframework/spring/messaging/unitofwork/SpringTransactionManager.java)
but I don't know how to go about this in Karaf.
Can anyone please nudge me in the right direction?
Kindest Regards
Cobus
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html