-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from asavershin/add-kafka
Add kafka
- Loading branch information
Showing
137 changed files
with
4,421 additions
and
350 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
# Start api | ||
|
||
./mvnw clean package | ||
В папке api: docker compose up -d | ||
|
||
docker compose -f kafka/docker-compose.yml up --build -d | ||
|
||
После того как запустится кафка | ||
|
||
docker compose -f api/docker-compose.yml up --build -d | ||
|
||
docker compose -f worker/docker-compose-blackwhite.yml up --build -d | ||
docker compose -f worker/docker-compose-rotate.yml up --build -d | ||
docker compose -f worker/docker-compose-imagga.yml up --build -d | ||
|
||
|
||
|
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
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
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
8 changes: 7 additions & 1 deletion
8
api/src/main/java/com/github/asavershin/api/common/NotFoundException.java
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
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
9 changes: 9 additions & 0 deletions
9
api/src/main/java/com/github/asavershin/api/common/domain/DomainEvent.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.github.asavershin.api.common.domain; | ||
|
||
public interface DomainEvent<T> { | ||
/** | ||
* Using for publishing new events. | ||
* @return Message for publisher | ||
*/ | ||
T publish(); | ||
} |
4 changes: 4 additions & 0 deletions
4
api/src/main/java/com/github/asavershin/api/common/domain/package-info.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* Some common classes for domain. | ||
*/ | ||
package com.github.asavershin.api.common.domain; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,5 @@ | |
value = Command.class) | ||
} | ||
) | ||
public class AnnotationsConfig { | ||
public class AnnotationsConf { | ||
} |
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
43 changes: 43 additions & 0 deletions
43
api/src/main/java/com/github/asavershin/api/config/Bucket4jConfig.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.github.asavershin.api.config; | ||
|
||
import io.github.bucket4j.Bandwidth; | ||
import io.github.bucket4j.Bucket; | ||
import io.github.bucket4j.BucketConfiguration; | ||
import io.github.bucket4j.distributed.ExpirationAfterWriteStrategy; | ||
import io.github.bucket4j.distributed.proxy.ClientSideConfig; | ||
import io.github.bucket4j.distributed.proxy.ProxyManager; | ||
import io.github.bucket4j.redis.lettuce.cas.LettuceBasedProxyManager; | ||
import io.lettuce.core.RedisClient; | ||
import io.lettuce.core.RedisURI; | ||
import io.lettuce.core.api.StatefulRedisConnection; | ||
import io.lettuce.core.codec.ByteArrayCodec; | ||
import io.lettuce.core.codec.RedisCodec; | ||
import io.lettuce.core.codec.StringCodec; | ||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
|
||
import java.time.Duration; | ||
import java.util.function.Supplier; | ||
|
||
@Configuration | ||
public class Bucket4jConfig { | ||
@Bean | ||
public RedisClient redisClient(final RedisProperties redisProperties) { | ||
return RedisClient.create( | ||
RedisURI.Builder.redis(redisProperties.getHost(), redisProperties.getPort()) | ||
.withPassword(redisProperties.getPassword().toCharArray()).build()); | ||
} | ||
|
||
@Bean | ||
public ProxyManager<String> lettuceBasedProxyManager(final RedisClient redisClient) { | ||
StatefulRedisConnection<String, byte[]> redisConnection = redisClient | ||
.connect(RedisCodec.of(StringCodec.UTF8, ByteArrayCodec.INSTANCE)); | ||
|
||
return LettuceBasedProxyManager | ||
.builderFor(redisConnection) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.