Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Design


Micronaut is a microservice framework for building moudlar 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

Auto-Configuration

additional configuration can be achieved through BeanCreatedEventListener.

...

Micronaut can span an instance of Ignite automatically. Below we review several configuration options.

Ignite Thick Clients

Ignite Thick Client Bean Configuration

A thick client bean can be configured via the application properties file as follows:

Code Block
languageyml
titleexample config
ignite: 
	enabled: true
	client-mode: true
	discovery-spi:
		static-ip-finder:
			enabled: true
			addresses:
			- "127.0.0.1:47500"
			- "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
languageyml
titleexample config
ignite: 
	enabled: true
    client-mode: true
	comunicationdiscovery-spi:
		local-port: 5555kubernetes-ip-finder:
			enabled: true
			namespace: default
			service-name: ignite


Additional configuration can be applied on top of the default configuration by intercepting the bean when its created, Using the BeanCreatedEventListener.

Code Block
languagejava

@Singleton
public class IgniteConfigurationFactoryInterceptor implements BeanCreatedEventListener<DefaultIgniteConfiguration> {
    @Override
    public DefaultIgniteConfiguration onCreated(BeanCreatedEvent<DefaultIgniteConfiguration> event) {
        DefaultIgniteConfiguration configuration = event.getBean();
        configuration.setIgniteInstanceName("instance-a");
        return configuration;
    }
}

Ignite Cache Configuration


Code Block
languageyml
titleexample 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
languagejava
titleexample config
@Factory
public class configurationFactory(){

    @Singleton
    @Bean
    @IgnitePrimary
    CacheConfiguration<String,String> cacheInstance() {
        return new CacheConfiguration<String, String>("my-cache")
            .setBackups(10);
    }
}
			

Ignite

...

Thin Clients -

...

WIP

kubernetes


Code Block
languageyml
titleexample configThin Client Configuration
ignite: 
	enabled: true
	discovery-spi:
		kubernetes-ip-finder:
			enabled: trued
			namespace: default
			service-name: ignite

static-ip-finder

Code Block
languageyml
titleexample config
ignite: 
	-thin-client:
  enabled: true
	discovery-spi:
		static-ip-finder:
			enabled: true
			addresses:
			  addresses:
    - "127.0.0.1:4750010800"
			    - "127.0.0.1:47501"

Ignite factory configuration

A bean for an IgniteConfiguration can be provided from a factory.

Example:
Code Block
languagejava
@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;
    }
}

10801"

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