...
Micronaut is a microservice framework for building moudlar modular applications. This develops a configuration that bests works with Micronaut.
Auto-Configuration
additional Micronaut can span an instance of Ignite automatically. Below we review several configuration options. Additional configuration can be achieved through BeanCreatedEventListener.
Minimum Configuration
Code Block |
---|
language | yml |
---|
title | example config |
---|
|
ignite:
enabled: true
comunication-spi:
local-port: 5555
|
Ignite Cache Configuration
Ignite Thick Clients
Ignite Thick Client Bean Configuration
A thick client bean can be configured via the application properties file as follows:
Code Block |
---|
language | yml |
---|
title | example config |
---|
|
ignite:
enabled: true
cacheclient-configurations:
name:
group-name: string
onheap-cache: boolean
sql-onheap-cache: booleanmode: true
discovery-spi:
static-ip-finder:
eager-ttlenabled: booleantrue
cache-mode: LOCAL | REPLICATED | PARTITIONEDaddresses:
rebalance-mode: SYNC | ASYNC | NONE
data-region-name: string "127.0.0.1:47500"
key-type: java.Object
value-type: java.Object
second:
group-name: two
"127.0.0.1:47501" |
Instead of the static IP finder, you can enable the Kubernetes one if a Micronaut app is deployed in a K8S environment:
Code Block |
---|
language | javayml |
---|
title | example config |
---|
|
@Factory
public class configurationFactory(){
@Singletonignite:
enabled: true
@Bean
@IgnitePrimary
CacheConfiguration<String,String> cacheInstance() {
return new CacheConfiguration<String, String>("my-cache")
.setBackups(10);
}
}
|
Ignite discovery-spi Configuration
kubernetes
Code Block |
---|
language | yml |
---|
title | example config |
---|
|
ignite:
enabled: client-mode: true
discovery-spi:
kubernetes-ip-finder:
enabled: truedtrue
namespace: default
service-name: ignite
|
static-ip-finder
Code Block |
---|
language | yml |
---|
title | example config |
---|
|
ignite:
enabled: true
discovery-spi:
static-ip-finder:
enabled: true
addresses:
- "127.0.0.1:47500"
- "127.0.0.1:47501" |
Ignite factory configuration
A bean for an IgniteConfiguration can be provided from a factory.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:
Example:
Code Block |
---|
|
@Factory
public class MyFactory {
@Singleton
@Bean
@Primary
@Named("default")
IgniteConfiguration defaultConfiguration() {
IgniteConfiguration cfg = new IgniteConfiguration();
// The node will be started as a client node.
cfg.setClientMode(true);
// Setting up an IP Finder to ensure the client can locate the servers.
TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
ipFinder.setAddresses(Collections.singletonList("localhost:47500..47509"));
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder));
return cfg;
}
}
|
Ignite Cache Configuration
Code Block |
---|
language | yml |
---|
title | example config |
---|
|
ignite:
enabled: true
cache-configurations:
name:
group-name: string
onheap-cache: boolean
sql-onheap-cache: boolean
eager-ttl: boolean
cache-mode: LOCAL | REPLICATED | PARTITIONED
rebalance-mode: SYNC | ASYNC | NONE
data-region-name: string
key-type: java.Object
value-type: java.Object
second:
group-name: two
|
Code Block |
---|
language | java |
---|
title | example config |
---|
|
@Factory
public class configurationFactory(){
@Singleton
@Bean
@IgnitePrimary
CacheConfiguration<String,String> cacheInstance() {
return new CacheConfiguration<String, String>("my-cache")
.setBackups(10);
}
}
|
Ignite Thin Clients
TBD
Micronaut Ignite Cache
Micronaut cache 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.
...
Micronaut Ignite Application
https://github.com/pollend/micronaut-ignite-sample