0 votes
asked in MicroStream for Java by (170 points)

Is there anyone who tried MircoStream Persistence inside a Quarkus app? I wrote a simple Quarkus app storing a simple bean. This runs as expected in a plan Java program. Then I tried to do the same code inside a Quarkus app (quarkus.io). Everything seems to work fine until I stop end start the app again. The existing storage is not used and a new storage is created.

So, is anyone using MicroStream with Quarkus?

Testproject: https://github.com/bernmic/docster

1 Answer

0 votes
answered by (3.4k points)

Hello,

I just looked at your code. There is one issue:

During the storage initialization you need to set the root element before storing:

storageManager.setRoot(archiveRoot);

void onStart(@Observes final StartupEvent ev) {
    LOGGER.info("The application is starting...");
    storageManager = EmbeddedStorage.start(/*Paths.get(dataPath)*/);
    if (storageManager.root() == null) {
        archiveRoot = new ArchiveRoot();
        archiveRoot.setName("MainArchive");
        archiveRoot.setPath("~/Documents");
        archiveRoot.setDescription("The main archive");
        storageManager.setRoot(archiveRoot);
        storageManager.storeRoot();
        LOGGER.info("Created a new archive");
    }...

 

Best regards

commented by (170 points)
Thank you ver much. I had this before. But I missed to initialize the root variable. So I gave a null into setRoot.
asked May 26 in MicroStream for Java by (170 points)
edited May 26 by
0 votes
Still not loading, now using existing root instead
Notes: Every question must be a separate forum post. Headline: Formulate your question shortly and precisely. Thank you!
Powered by Question2Answer
...