Skip to content

Instantly share code, notes, and snippets.

View lmonkiewicz's full-sized avatar

Łukasz Monkiewicz lmonkiewicz

View GitHub Profile
import java.nio.ByteBuffer;
import java.util.Base64;
import java.util.UUID;
public class Base64ToUUID {
// Method to convert UUID to base64 (without padding)
public static String uuidToBase64(UUID uuid) {
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
byteBuffer.putLong(uuid.getMostSignificantBits());
metricOperations.increment(KafkaMetrics.METRIC_NAME,
Tags.of(KafkaTags.topic(topic),
KafkaTags.exception(exception.getClass().getName()),
KafkaTags.processor(context.applicationId())
));
@RequiredArgsConstructor
@Component
public class MetricOperations {
private final MeterRegistry meterRegistry;
public Counter counter(String metricName, Tags tags) {
return meterRegistry.counter(metricName, tags);
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
package pl.effectivedev.iban.ibantest;
import java.math.BigInteger;
import java.time.LocalDate;
import java.util.Map;
import java.util.TreeMap;
public class IbanService {
Map<String, IbanStructure> structures = new TreeMap<>();
@lmonkiewicz
lmonkiewicz / pom.xml
Created February 9, 2023 09:52
openapi openapi openapi
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.2.1</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>
<goals>
<goal>generate</goal>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
spring:
cloud:
stream:
kafka:
binder:
brokers: localhost:9092
autoCreateTopics: true
configuration:
sasl.mechanism: PLAIN
spring:
cloud:
stream:
poller:
fixedDelay: 100
max-messages-per-poll: 100
default:
content-type: application/*+avro
producer:
@Configuration
public class PartitionExampleConfiguration {
@Bean
public Function<
KStream<String, ExampleValue>, KStream<String, ExampleValue>> transform() {
return kstream -> kstream.selectKey((key, value) -> value.getSomeProperty());
}
}