Table of Contents |
---|
Micronaut is a microservice framework for building modular applications. This develops a configuration that bests works with Micronaut.
Documentation: https://micronaut-projects.github.io/micronaut-ignite/snapshot/guide/
Releases: https://github.com/micronaut-projects/micronaut-ignite/releases
Micronaut can span an instance of Ignite automatically. Below we review several configuration options. Additional configuration can be achieved through BeanCreatedEventListener.
...
Code Block | ||||
---|---|---|---|---|
| ||||
ignite: enabled: true client-mode: true discovery-spi: kubernetes-ip-finder: enabled: true namespace: default service-name: ignite |
The property-file based configuration option above supports a subset of configuration parameters provided by the IgniteConfiguration class. Provide an IgniteConfiguration bean programmatically from a factory if you need to set any parameter that is unsupported by the property-file configuration method:
...
Additional configuration can be applied on top of the default configuration by intercepting the bean when its created, Using the BeanCreatedEventListener.
Code Block | ||
---|---|---|
| ||
@Factory @Singleton public class MyFactoryIgniteConfigurationFactoryInterceptor { implements BeanCreatedEventListener<DefaultIgniteConfiguration> @Singleton{ @Bean@Override @Primary public DefaultIgniteConfiguration @Named("default") IgniteConfiguration defaultConfiguration(onCreated(BeanCreatedEvent<DefaultIgniteConfiguration> event) { IgniteConfigurationDefaultIgniteConfiguration cfgconfiguration = new IgniteConfiguration(); // The node will be started as a client node. cfg.setClientMode(trueevent.getBean(); // Setting up an IP Finder to ensure the client can locate the servers. TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder(); ipFinder.setAddresses(Collections.singletonList("localhost:47500..47509"))configuration.setIgniteInstanceName("instance-a"); cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder)); return cfgconfiguration; } } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
@Factory public class configurationFactory(){ @Singleton @Bean @IgnitePrimary CacheConfiguration<String,String> cacheInstance() { return new CacheConfiguration<String, String>("my-cache") .setBackups(10); } } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
ignite-thin-client:
enabled: true
addresses:
- "127.0.0.1:10800"
- "127.0.0.1:10801" |
Micronaut cache is covered under snapshot documentation. By default, the primary Ignite instance is used for Micronaut cache and the key from for each cache operation will refer to the IgniteCache instance.
...