Skip to content
  • Products
    • Persistence for Java / JVM
    • Persistence for Android
    • MicroStream Cluster
    • Serializer
  • Community
    • GitHub
    • Discussion
    • Contribute
    • Issues
    • StackOverflow
  • Resources
    • Get Started
    • Docs
    • Examples
    • Videos
    • Blog
    • Release & Update Plan
  • Services
    • Support
    • Training
  • Company
    • About us
    • Contact
  • Subscribe to our Newsletter
  • User icon Sign in

Cookie

We use cookies to make it easier to use and to further improve our service.

If you have given us your consent, you can revoke it at any time in the data protection declaration.

Use all cookies Manage cookies Reject cookies

Cookie

?
?
?
Use all cookiesSave settingsReject cookiesView Privacy Policy

Necessary

Necessary cookies help make a website usable by enabling basic functions such as page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

Name Anbieter Zweck Ablauf Typ
c3kie_removeCookieWindow microstream.one Saves the consent status of the user whether the cookie window should be displayed. 1 Jahr HTML Local Storage
c3kie_googleAnalytics microstream.one Saves the consent status of the user as to whether Google Analytics is allowed to run. 1 Jahr HTML Local Storage
c3kie_googleAnalytics microstream.one Saves the consent status of the user as to whether Google Analytics is allowed to run. 1 Jahr HTML Local Storage
c3kie_tagManager microstream.one Saves the consent status of the user as to whether Google Tag Manager is allowed to run. 1 Jahr HTML Local Storage
c3kie_facebook microstream.one Saves the consent status of the user as to whether Facebook is allowed to run. 1 Jahr HTML Local Storage
c3kie_matomo microstream.one Saves the consent status of the user as to whether Matomo is allowed to run. 1 Jahr HTML Local Storage
c3kie_youtube microstream.one Saves the consent status of the user as to whether YouTube is allowed to run. 1 Jahr HTML Local Storage

Statistics

Statistics cookies help website owners understand how visitors interact with websites by collecting and reporting information anonymously.

Name Anbieter Zweck Ablauf Typ
_dc_gtm_ Google Used by Google Analytics to limit the request rate. 1 Jahr HTTP Cookie
_gid_ Google Registers a unique ID that is used to generate statistical data on how the visitor uses the website. 2 Jahre HTTP Cookie
_gcl_au Google Used to send data to Google Analytics about the device and visitor behavior. Captures the visitor across devices and marketing channels. Session Pixel Tracker
_gat_ Google Used to store a unique user ID. 1 Tag HTTP Cookie
_gat_gtag_UA_ Google Used to store a unique user ID. 1 Tag HTTP Cookie
yt-player-headers-readable YouTube Used to determine the optimal video quality based on the visitor's device and network settings. Persistent HTML Local Storage

Marketing

Marketing cookies are used to track visitors across websites. The intent is to show ads that are relevant and engaging to the individual user, making them more valuable to publishers and third party advertising providers.

Name Anbieter Zweck Ablauf Typ
VISITOR_INFO1_LIVE YouTube Tries to estimate the range of users on pages with built-in YouTube videos. 179 Tage HTTP Cookie
YSC YouTube Registers a unique ID to keep statistics on which videos from YouTube the user has seen. Session HTTP Cookie
yt.innertube::nextId YouTube Registers a unique ID to keep statistics on which videos from YouTube the user has seen. Persistent HTML Local Storage
yt.innertube::requests YouTube Registers a unique ID to keep statistics on which videos from YouTube the user has seen. Persistent HTML Local Storage
ytidb::LAST_RESULT_ENTRY_KEY YouTube Saves the user's video player settings with embedded YouTube video. Persistent HTML Local Storage
yt-remote-cast-available YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-cast-installed YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-connected-devices YouTube Saves the user's video player settings with embedded YouTube video. Persistent HTML Local Storage
yt-remote-device-id YouTube Saves the user's video player settings with embedded YouTube video. Persistent HTML Local Storage
yt-remote-fast-check-period YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-session-app YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-session-name YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage

Updates to the Spring Boot integration in version 7.1

Oct142022
BlogReleases

With the MicroStream framework, the JVM memory and Java objects are considered to be the database so that you avoid conversion and latency delays when you retrieve the data from an external system.

When working with MicroStream, three aspects are important. The configuration of the StorageManager, access to the root object of the Object graph that keeps your data, and access to the StorageManager itself to initiate storing the binary representation of the changed objects so that they survive the process restart.

Integrations into frameworks like Spring boot, but also the other integrations that are maintained by MicroStream itself like the Jakarta EE one, facilitates these 3 aspects using features of the framework itself.

This blog goes into the details of using the Spring Boot integration and its new functionality of version 7.1 the was released recently.  You can find more examples in the GitHub repository.

Adding the integration

To use the MicroStream Spring Boot integration, add the microstream-integrations-spring-boot dependency to your project

<properties>
   <microstream.version>07.01.00-MS-GA</microstream.version>
</properties>

<dependencies>
   <dependency>
      <groupId>one.microstream</groupId>
      <artifactId>microstream-integrations-spring-boot</artifactId>
      <version>${microstream.version}</version>
   </dependency>
</dependencies>

 

This dependency also brings in the required artifacts from MicroStream itself, so it is the only entry that is needed for your project.

Now that we have the dependency, we can start by defining the configuration.

Configuration of the Storage Manager

The configuration of the framework must cover the 2 main aspects of MicroStream, identifying the Root object of the Object Graph and indicating where the binary representation of the Object Graph is stored.

Let us start with the first requirement, identifying the Root Object. Since it is the idea that the integration code handles the entire setup of MicroStream, we also need a way of indicating what class we will use as Root Object. This can be done by annotating it with one.microstream.integrations.spring.boot.types.Storage.

@Storage
public class Root {

 

The other part is done by defining configuration values that not only sets the path for the storage when using the disk as a storage medium but all configuration properties described on the documentation page are supported. You only need to make sure the keys are prepended with one.microstream. to make sure we do not have a name clash with any other key value that is also set using Spring Boot configuration.

one.microstream.storage-directory=<path-to-storage>>
one.microstream.channel-count=2

The above entries in the application.properties file, but any supported Spring Boot configuration source is also supported, makes that there are 2 channels used for the indicated directory.

But some applications might need some more advanced configuration and/or initialisation which is now supported in the recently released version 7.1.

The entire flow of the configuration is as follows

– Read the configuration properties and instantiate an EmbeddedStorageFoundation with these values.
– Call any Spring bean that implements the EmbeddedStorageFoundationCustomizer interface
– Create the StorageManager and start it.
– Call any Spring bean that implements the StorageManagerInitializer interface

By calling those Spring Beans, you can perform any additional configuration programmatically that you might need for your application.

With the EmbeddedStorageFoundationCustomizer you can add additional handlers for example. The MicroStream specialised JDK8 ones or your custom ones if you have created them are an example.

@Component
public class FoundationCustomizer implements EmbeddedStorageFoundationCustomizer {

   @Override
   public void customize(EmbeddedStorageFoundation embeddedStorageFoundation) {
      embeddedStorageFoundation.onConnectionFoundation(BinaryHandlersJDK8::registerJDK8TypeHandlers);
   }
}

After the StorageManager is active, you have an additional opportunity for initialisation. Adding some basic data to an empty database is a typical action you can perform within a Bean that implements the StorageManagerInitializer interface.

@Component
public class RootPreparation implements StorageManagerInitializer {

   @Override
   public void initialize(StorageManager storageManager) {

      Root root = (Root) storageManager.root();
      // Init 'database' with some data when it is empty.
      if (root.getBooks().isEmpty()) {
         init(root, storageManager);
      }

   }
}

 

Access Root and Storage Manager

With the configuration in place, we have a StorageManager and Root object that is fully prepared to be used in your application. The integration makes these instances also available as Spring beans. This means you can inject them, field injection and constructor injection are supported as we tap into the standard Spring functionality, in any other Spring bean.

You can also inject dependencies into the class that is annotated with @Storage. Constructor injection is not supported, the class requires a no-arg constructor so that we can contract it, but field injection is available. This allows you to inject the StorageManager into the Root class itself for example so that changes to the data can be stored.

And since the Root object became a Spring bean, you can inject it into service or repository classes to access your data and perform the logic required for the user request.

Conclusion

With the new 7.1 release of MicroStream, we have added new functionality to the Spring Boot integration code. Besides the usage of configuration values that were available in earlier versions, we have added the opportunity to programmatically fine-tune the StorageManager configuration through Spring beans that implement a certain interface.

The indication of the Root object with the annotation is also a new addition and allows you now to access it very easily as Spring bean throughout your entire codebase.

These additions make the usage of the MicroStream framework in Spring boot very easy.

Categories: Blog, ReleasesOctober 14, 2022Leave a comment
Tags: IntegrationMicroStreamSpring Boot

Author: Rudy De Busscher

Post navigation

PreviousPrevious post:Using Cloud storage platforms with MicroStreamNextNext post:Store State of a Background process with MicroStream

Related Posts

The optimal Lazy List size
March 10, 2023
Not all Data are Equally
February 17, 2023
A peek into upcoming version 8.0
January 26, 2023
MicroStream as Spring Cache provider
January 5, 2023
MicroStream joins the Eclipse Foundation
MicroStream is now an Eclipse Foundation Member
December 21, 2022
Some Data Model considerations for searching and indexing with MicroStream
December 12, 2022

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Post comment

Search
Categories
  • Blog(42)
  • CloudNotification(1)
  • Conferences(13)
  • General(3)
  • News(18)
  • Performance(1)
  • Releases(12)
  • Training(3)
Related Posts
  • May 16 – 17:00 – 21:00 CEST MicroStream Advanced Course Part 2
    March 13, 2023
  • May 9 – 17:00 – 21:00 CEST MicroStream Advanced Course Part 1
    March 13, 2023
  • April 26 – 17:00 – 21:00 CEST MicroStream Fundamentals Course
    March 13, 2023
  • The optimal Lazy List size
    March 10, 2023
  • MicroStream Cloud is now online!
    March 8, 2023
  • Not all Data are Equally
    February 17, 2023
  • A peek into upcoming version 8.0
    January 26, 2023
  • MicroStream as Spring Cache provider
    January 5, 2023
  • MicroStream joins the Eclipse Foundation
    MicroStream is now an Eclipse Foundation Member
    December 21, 2022
  • Some Data Model considerations for searching and indexing with MicroStream
    December 12, 2022
Tags
Android AWS Cache Cloud connector Cluster Communication Conference Data Persistence developers event feature framework free fundamentals GitHub Hackathon Heldion How to InfoQ Integration Java Java 17 JAVAPRO JCON logging LTS Micronaut MicroProfile Microservices MicroStream MicroStream 2 MicroStream 4 MicroStream 6 New Features online Open Liberty Open Source Oracle Performance public Red Hat Summit release Serialization Spring Boot Training
MicroStream

Store Java Object Graphs natively, relieved of heavy-weight DBMS Dependencies. Create ultra-fast In- Memory Database Applications & Microservices with Pure Java. The Pure Java Paradigm Shift in Database Development.

Upcoming Event

April 19, 2023 | 17:00 – 21:00 CEST
Read more

Platforms

  • MicroStream for Java / JVM
  • MicroStream for Android

Community

  • GitHub
  • Discussion
  • Contribute
  • Issues
  • StackOverflow
  • MeetUp

Resources

  • Get Started
  • Docs
  • Examples
  • Videos
  • Blog
  • Release plan

Services

  • Support
  • Training

Company

  • About us
  • Contact

Stay Connected

  • Twitter
  • LinkedIn
  • YouTube
  • GitHub
  • StackOverflow
  • MeetUp

Get the latest MicroStream news:

Subscribe

© 2023 MicroStream Software. All rights reserved.
  • Terms of use
  • Privacy
  • Legal notice

Cookie

We use cookies to make it easier to use and to further improve our service.

If you have given us your consent, you can revoke it at any time in the data protection declaration.

Use all cookies Manage cookies Reject cookies

Cookie

?
?
?
Use all cookiesSave settingsReject cookiesView Privacy Policy

Necessary

Necessary cookies help make a website usable by enabling basic functions such as page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

Name Anbieter Zweck Ablauf Typ
c3kie_removeCookieWindow microstream.one Saves the consent status of the user whether the cookie window should be displayed. 1 Jahr HTML Local Storage
c3kie_googleAnalytics microstream.one Saves the consent status of the user as to whether Google Analytics is allowed to run. 1 Jahr HTML Local Storage
c3kie_googleAnalytics microstream.one Saves the consent status of the user as to whether Google Analytics is allowed to run. 1 Jahr HTML Local Storage
c3kie_tagManager microstream.one Saves the consent status of the user as to whether Google Tag Manager is allowed to run. 1 Jahr HTML Local Storage
c3kie_facebook microstream.one Saves the consent status of the user as to whether Facebook is allowed to run. 1 Jahr HTML Local Storage
c3kie_matomo microstream.one Saves the consent status of the user as to whether Matomo is allowed to run. 1 Jahr HTML Local Storage
c3kie_youtube microstream.one Saves the consent status of the user as to whether YouTube is allowed to run. 1 Jahr HTML Local Storage

Statistics

Statistics cookies help website owners understand how visitors interact with websites by collecting and reporting information anonymously.

Name Anbieter Zweck Ablauf Typ
_dc_gtm_ Google Used by Google Analytics to limit the request rate. 1 Jahr HTTP Cookie
_gid_ Google Registers a unique ID that is used to generate statistical data on how the visitor uses the website. 2 Jahre HTTP Cookie
_gcl_au Google Used to send data to Google Analytics about the device and visitor behavior. Captures the visitor across devices and marketing channels. Session Pixel Tracker
_gat_ Google Used to store a unique user ID. 1 Tag HTTP Cookie
_gat_gtag_UA_ Google Used to store a unique user ID. 1 Tag HTTP Cookie
yt-player-headers-readable YouTube Used to determine the optimal video quality based on the visitor's device and network settings. Persistent HTML Local Storage

Marketing

Marketing cookies are used to track visitors across websites. The intent is to show ads that are relevant and engaging to the individual user, making them more valuable to publishers and third party advertising providers.

Name Anbieter Zweck Ablauf Typ
VISITOR_INFO1_LIVE YouTube Tries to estimate the range of users on pages with built-in YouTube videos. 179 Tage HTTP Cookie
YSC YouTube Registers a unique ID to keep statistics on which videos from YouTube the user has seen. Session HTTP Cookie
yt.innertube::nextId YouTube Registers a unique ID to keep statistics on which videos from YouTube the user has seen. Persistent HTML Local Storage
yt.innertube::requests YouTube Registers a unique ID to keep statistics on which videos from YouTube the user has seen. Persistent HTML Local Storage
ytidb::LAST_RESULT_ENTRY_KEY YouTube Saves the user's video player settings with embedded YouTube video. Persistent HTML Local Storage
yt-remote-cast-available YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-cast-installed YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-connected-devices YouTube Saves the user's video player settings with embedded YouTube video. Persistent HTML Local Storage
yt-remote-device-id YouTube Saves the user's video player settings with embedded YouTube video. Persistent HTML Local Storage
yt-remote-fast-check-period YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-session-app YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage
yt-remote-session-name YouTube Saves the user's video player settings with embedded YouTube video. Session HTML Local Storage