0
votes

I am using the ignite-spring-boot-autoconfigure-ext official Ignite library for integration with my Spring Boot application. I took this example as a base: https://ignite.apache.org/docs/latest/extensions-and-integrations/spring/spring-boot#set-ignite-up-via-spring-boot-configuration The example seems pretty simple, but it shows only a small subset of Ignite configuration options. I tried to configure an IP finder and also a near cache with an eviction policy but without any success. To make matters worse incorrect configuration is usually silently ignored.

Are there more complete examples of how to use this configuration or it simply does not support more advanced configuration options?

1
I recommend using a dedicated Ignite XML configuration file. - alamar
@alamar can you elaborate on why it is preferable? - Sergey
Because it is used every day by hundreds of users who know this process in and out. For Spring Boot configuration, you're on your own. I remember maybe one inquiry about this config format, per year. Unless you're an expert in Spring Boot, I would recommend using classic Spring XML. - alamar
It's a new integration that Ignite added less than a year ago (May 2020), so I expected it to work better now. - Sergey
It still has more than one way to start Ignite, so maybe you need to use the programmatic one. Unless you are expert on the application.yml. If you are, it should be really very straightforward. - alamar

1 Answers

1
votes

application.yml is just a properties file, it's not a context configuration file.

application.yml helps you to set (override) properties. In the above example it overrides propertis of IgniteConfiguration class located under "ignite." in your application.yml file..

IP finder is a part ot tcpDiscoverySpi which is abstract interface so there are no setters or getters for properties to be able to override them from yml file.

You can still use XML Spring context convifiration or configure Ignite instance programatically using @ConfigurationProperties and @Value annotations :

application.yml:

ignite-ext:
  vm-ip-finder:
    addresses:
      - 192.168.0.1:47500
      - 192.168.0.1:47501
      - 192.168.0.1:47502

Usage:

@SpringBootApplication
public class AutoConfigureExample {
    @Bean
    @ConfigurationProperties(prefix = "ignite-ext.vm-ip-finder")
    public TcpDiscoveryVmIpFinder tcpDiscoveryVmIpFinder() {
        return new TcpDiscoveryVmIpFinder();
    }
}

@Bean
public CommandLineRunner runner() {
    @Autowired
    TcpDiscoveryVmIpFinder tcpDiscoveryVmIpFinder;
    return new CommandLineRunner() {
        ....
    }
}