This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gaurav.examples.redis.bloomfilter.controller; | |
import gaurav.examples.redis.bloomfilter.service.UserNameValidatorService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gaurav.examples.redis.bloomfilter.service.impl; | |
import gaurav.examples.redis.bloomfilter.service.BloomFilterService; | |
import gaurav.examples.redis.bloomfilter.service.UserNameValidatorService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Service; | |
@Service | |
public class UserNameValidatorServiceImpl implements UserNameValidatorService { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gaurav.examples.redis.bloomfilter.service.impl; | |
import gaurav.examples.redis.bloomfilter.service.BloomFilterService; | |
import lombok.Synchronized; | |
import lombok.extern.log4j.Log4j2; | |
import org.ajbrown.namemachine.NameGenerator; | |
import org.redisson.api.RBloomFilter; | |
import org.redisson.api.RedissonClient; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.context.event.ApplicationReadyEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gaurav.examples.redis.bloomfilter.config; | |
import org.redisson.Redisson; | |
import org.redisson.api.RedissonClient; | |
import org.redisson.config.Config; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring.application.name=Redis-BloomFilter | |
server.servlet.context-path=/rBloom | |
server.port=8080 | |
redisson.redisUrl=redis://127.0.0.1:6379 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gaurav.examples.redis.bloomfilter.config; | |
import lombok.Data; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.stereotype.Component; | |
@Component | |
@ConfigurationProperties("redisson") | |
@Data | |
public class RedissonConfig { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.springframework.boot' version '2.3.1.RELEASE' | |
id 'io.spring.dependency-management' version '1.0.9.RELEASE' | |
id 'java' | |
} | |
group = 'gaurav.examples' | |
version = '0.0.1-SNAPSHOT' | |
sourceCompatibility = '1.8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GatewayServer extends Server { | |
private double ratio; | |
private PaymentGateway gateway; | |
public GatewayServer(String host, int port, double ratio, PaymentGateway gateway) { | |
super(host, port); | |
this.ratio = ratio; | |
this.gateway = gateway; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class GatewayUtilServiceImpl implements GatewayUtilService { | |
@Autowired | |
private LoadBalancerClient loadBalancer; | |
@Override | |
public PaymentGateway getPaymentGateway() { | |
ServiceInstance instance = loadBalancer.choose("payment-gateway"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@RibbonClient(name = "payment-gateway", configuration = PaymentGatewayConfiguration.class) | |
public class PaymentGatewayConfiguration { | |
@Bean | |
public IPing ribbonPing(IClientConfig config) { | |
return new PingUrl(); | |
} | |
@Bean |
NewerOlder