modify riak start

This commit is contained in:
ggmaleva 2021-09-30 13:58:16 +03:00
parent af2b7c3c7e
commit a474d130a6
No known key found for this signature in database
GPG Key ID: 0E412B78565B108F
2 changed files with 26 additions and 3 deletions

View File

@ -22,10 +22,8 @@ public class RiakConfig {
.withRemoteAddress(riakAddress) .withRemoteAddress(riakAddress)
.withRemotePort(riakPort) .withRemotePort(riakPort)
.build(); .build();
RiakCluster cluster = new RiakCluster.Builder(node) return new RiakCluster.Builder(node)
.build(); .build();
cluster.start();
return cluster;
} }
@Bean @Bean

View File

@ -0,0 +1,25 @@
package com.rbkmoney.wb.list.manager.config;
import com.basho.riak.client.core.RiakCluster;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
@Slf4j
public class RiakInitializer {
private final RiakCluster riakCluster;
@EventListener(value = ApplicationReadyEvent.class)
@Order
public void onStartup() {
log.info("Starting RiakCluster");
riakCluster.start();
}
}