Skip to content

Instantly share code, notes, and snippets.

View zlatozar's full-sized avatar
🇧🇬
Давай!

Zlatozar Zhelyazkov zlatozar

🇧🇬
Давай!
View GitHub Profile
@zlatozar
zlatozar / bash_script_template.sh
Created March 18, 2025 15:05
BASH script temlate
#!/bin/bash
#------------------------------------------------------------------------------
# script_template - Briefly describe script purpose
#
# {Date}, Your name <your.email@example.com>
#
# Copyright (c) 2023, 2024 by {Company}, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
#
@zlatozar
zlatozar / OutboxPattern.java
Last active October 2, 2025 11:12
Outbox pattern code illustration
// Details: https://medium.com/@egorponomarev/outbox-pattern-in-spring-boot-8e8cf116f044
// ATTENTION: Order of messages is not preserved!
@Service
public record OrderService(
IDeliveryMessageQueueService deliveryMessageQueueService,
IOrderRepository orderRepository,
IOutboxRepository outboxRepository,
TransactionTemplate transactionTemplate) implements IOrderService {
@zlatozar
zlatozar / java_compile.sh
Created August 31, 2023 14:02
Build java maven project without having java installed
docker run -it --rm --name country-maven-project -v "$PWD":/usr/src/app -v "$HOME"/.m2:/root/.m2 -w /usr/src/app maven:3-eclipse-temurin-17 mvn clean package -DskipTests
@zlatozar
zlatozar / RetryFailed.java
Last active March 18, 2023 08:22
Organise Kafka retries to third party systems
public class RetryProcessor {
private final long schedulerIntervalMs = 60000;
private final String entityStoreName = "failed-message-store";
private KeyValueStore<String, Object> entityStore;
@Override
public void init(final ProcessorContext context) {
this.entityStore = (KeyValueStore) context().getStateStore(entityStoreName);
context().schedule(Duration.ofMillis(this.schedulerIntervalMs), PunctuationType.WALL_CLOCK_TIME,