运行点燃服务器节点

时间:2017-05-16 16:01:03

标签: java ignite

我想运行一些点火服务器节点并从中创建一个单独的群集组(称之为"WORKER")。来自此群集组的节点应该来自点燃队列的take()个元素,以某种方式处理它并将某些内容放入具有群集组"CACHE"的节点上的缓存中。这是它的样子:

public interface Batch{ }

public class Runner{

    //initialize batchesToProcess as ignite distrubted queue
    Queue<Batch> batchesToProcess;

    //I need Ignite here.
    //@IgniteInstanceResource does not work this way
    //Because this is just a bean declared in ingite spring configuration
    private Ignite ignite;

    public void executeLogic(){
        Batch b = batchesToProcess.take();
        String cacheName;
        String key;
        String value;
        //process Batch b, get 3 strings
        //1. cache name
        //2. key
        //3. value
        IgniteCache<String, String> cache = ignite.getOrCreateCache(cacheName);
        cache.put(key, value);
    }

}

我想通过使用指定的配置运行./ignite.sh _configuration_来启动此节点。

问题是我不知道如何编写此_configuration_,因此只需将此配置文件提供给./ignite.sh即可运行。也许我应该抓住ContextRefreshedEvent然后把它

1 个答案:

答案 0 :(得分:1)

Service Grid在这种情况下非常有用。创建服务并在IgniteConfiguration bean中提供它。它将在启动时自动部署。