Skip to content

Instantly share code, notes, and snippets.

Given a setup of 4 instances of a SpringBoot 2.x application with Kafka listeners.

  • 2 instances are running in Azure
  • 2 instances are running in a local DC.

The Kafka cluster is configured equally in all instances and is also running in the local DC. When messages arrive in a topic, they will only be processed by one of the app instances from the local DC. Only when the local app instances are stopped, the messages will be processed by one of the app instances in Azure.

Answer:

Your observation suggests a clear imbalance in Kafka consumer group behavior, favoring the local data center (DC) instances over the Azure instances, despite them being part of the same Spring Boot app and Kafka consumer group. The key question is: why do only local instances get partitions assigned and process messages?

@mike-seger
mike-seger / Q+A.md
Last active July 7, 2025 07:25
Planning

Question

in a scrum setup we are facing several planning issues for software development:

  • classifying stories by complexity numbers like fibonacci (1,3,5,8,13...) can be difficult because there are so many factors contributing
  • the complexity numbers are only of limited utility for time estimation
  • quarter time and capacity planning can be very inaccurate using the above
  • quarter planning is affected by many other factors which are not technically related to software development
  • quarter planning often has to be based on high level goals without detailed stories what are the possible measures to improve sprint and quarter (PI) planning?

Answer

@mike-seger
mike-seger / Util.java
Last active June 23, 2025 19:35
selenium
public static String snakeToTitleCase(String input) {
return Arrays.stream(input.toLowerCase().split("_"))
.filter(word -> !word.isEmpty())
.map(word -> Character.toUpperCase(word.charAt(0)) + word.substring(1))
.collect(Collectors.joining(" "));
}
@mike-seger
mike-seger / snip.txt
Last active May 29, 2025 00:03
correct upload
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.media.Content
import io.swagger.v3.oas.annotations.media.Schema
import io.swagger.v3.oas.annotations.parameters.RequestBody
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
import java.util.zip.ZipInputStream
@RestController
  • Narcissistic Personality Disorder (NPD) – Narcissists may gaslight to maintain their self-image, deflect blame, or manipulate others into serving their needs.
  • Antisocial Personality Disorder (ASPD) – People with ASPD may use gaslighting as part of a broader pattern of manipulation or exploitation.
  • Insecurity and Low Self-Esteem – Some gaslighters might not have a diagnosable disorder but may manipulate others out of fear, insecurity, or poor emotional regulation.
  • Learned Behavior – People who grow up in environments where manipulation was common may adopt gaslighting as a tool, even without understanding the harm they're causing.

Not Always Clinical: It’s important to note that not everyone who gaslights has a mental illness. Some people engage in gaslighting knowingly and deliberately as a form of abuse, while others might do it subconsciously without realizing the impact.

If you're dealing with gaslighting, whether from a partner, family member, friend, or coworker, it's worth taking seriously—reg

@mike-seger
mike-seger / fault-tolerance-libs.md
Last active March 17, 2025 17:57
What are the key differences between Resilience4j and dev.failsafe?

Resilience4j and dev.failsafe (Failsafe) are both fault-tolerance libraries for Java, but they have key differences in their architecture, feature set, and intended use cases. 1. Design and Philosophy

  • Resilience4j : Built specifically for resilience in microservices, inspired by Netflix Hystrix. It provides various fault-tolerance mechanisms as independent modules.

  • Failsafe : A more lightweight and flexible general-purpose retry/fault-tolerance library with a functional and fluent API.

2. Features Comparison

Feature Resilience4j Failsafe
@mike-seger
mike-seger / RestAssured SSLSocketFactory.kt
Last active March 14, 2025 18:03
RestAssured SSLSocketFactory
import io.restassured.RestAssured
import io.restassured.config.SSLConfig
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.SSLContext
import java.security.KeyStore
fun createSSLSocketFactory(): SSLSocketFactory {
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
trustManagerFactory.init(null as KeyStore?)

recipees

Method 1: Using sed

sed -i ':a;/^\n*$/{N;ba};/\n/{:b;/\n$/!{N;bb};s/^\n*//;s/\n*$//}' filename

Method 2: Using awk

awk '{if (NF || !blank) {print; blank=0} else if (!blank) {blank=1}}' filename > temp && mv temp filename

Method 3: Using perl

perl -i -0777 -pe 's/^\n+|\n+$//g' filename

import io.swagger.v3.oas.models.Paths
import io.swagger.v3.oas.models.OpenAPI
import org.springdoc.core.customizers.OpenApiCustomiser
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import java.util.TreeMap
@Configuration
class OpenApiConfig {
@mike-seger
mike-seger / merge-odd-even.md
Created December 15, 2024 19:43
Merge odd and even lines into a tab delimited file
awk 'NR % 2 == 1' input.txt > odd_lines.txt
awk 'NR % 2 == 0' input.txt > even_lines.txt
paste -d '\t' odd_lines.txt even_lines.txt