Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### Challenge 27 - Rate-Limiter

This challenge corresponds to the Rate Limiter which is of the Coding Challenges series by John Crickett.

### Description
The Rate Limiter is written in Java. The main purpose of this repository is to have understanding of how to build your own rate limiter, you will see that there are many @Bean annotation and filters and algorithm.

### Build Jar
Clone the project and build the jar, Otherwise I have also added the jar also which can be used directly. Read the usage section.

````
./gradlew clean build
````

I would highly suggest to clone this project and play with this, and have understanding of rate limiter.

### How to run it?

Just simply remove the comment from @Bean annotation and @Component from Services and filter and you are good to go.
This can be improved, but again the main purpose is to learn about rate limiter.

### Usage
Default port is 8080;

If you want to use redis then please add redis in localhost or any other server and add the IP in main class.
39 changes: 39 additions & 0 deletions rate-limiter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
HELP.md
.gradle
gradle/
report/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
38 changes: 38 additions & 0 deletions rate-limiter/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.17'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

group = 'com.learning'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '1.8'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation('org.springframework.boot:spring-boot-starter-data-redis') {
exclude group: 'io.lettuce.lettuce-core'
}
implementation 'com.github.houbb:redis-client-jedis:0.0.3'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
}
249 changes: 249 additions & 0 deletions rate-limiter/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading