RSSAmplifier

Blog

A guy with 'Ego' in his name

Recent content on A guy with 'Ego' in his name

bsideup.github.ioRSS feed ↗26 posts

Latest posts

MCP my HTTPS!

I get it. Every innovation requires a rewrite by a newer (and typically younger) generation. Containers, Blockchain, Crypto, WASM - they all could have been built on the existing tech (and, well, TLDs). Yet hipsters gonna hip! But every now and then something truly bizarre happens. To me, that’s MCP. MC who? Model Context Protocol (MCP) is a “standard” (gone are the days of…

NixOS on Raspberry Pi: The Good, the Bad and "the Linux way"

Gran Torino (Film) © 2008 Warner Bros. Pictures Disclaimer: this is not a tutorial, but a story of me trying the new hype thing that I am probably too old for 😀 I have a confession to start this article with: I have never enjoyed “the Linux way” of doing things: “Everything at once” package updates via distributives Having a strong allergy to binaries Piping like a 19 y.

Trying Rootless Docker with Testcontainers

Rootless Docker is one of the most exciting recent changes in the Docker ecosystem. It allows you to run the same good old Docker but without having to obtain root privileges on the machine. Installing Rootless Docker on a fresh VM Although you can run Rootless Docker-in-Docker, I wanted to try it on a fresh environment. A few seconds later, I had an Ubuntu VM running on Oracle Cloud to play with:

Daily Reactive: Context loss detection in Project Reactor

This post is a part of the &ldquo;Daily Reactive&rdquo; series of short posts about common situations with Project Reactor and Reactive Programming. One of the unique features of Project Reactor is the Context support. It allows you to associate an immutable context (represented by key/value pairs) and pass it to the upstream subscribers: public Flux<Item> getItems() { return…

Human-friendly Domains with Knative

Introduction Recently, I started playing with Kubernetes and Knative. The trigger was the credits I received to play with Oracle Cloud. I did not know how to use them and on which services (Java is the only Oracle&rsquo;s product I use :D), so I googled &ldquo;oracle cloud kubernetes&rdquo; and 15 minutes later I had a running cluster to play with. Nice! After installing Knative (k apply -f FTW!)…

Writing TCKs with JUnit Jupiter&#39;s Dynamic Tests

When you develop a library that provides some abstraction, or write a spec, it is a good practice to include a TCK (Technology Compatibility Kit) that the implementers can use to verify the behavior of their implementation and how well it matches the spec. You may find various TCKs out there, e.g. the Reactive Streams TCK. I just need something to test Let&rsquo;s start with a simple example…

Daily Reactive: Let&#39;s talk about ThreadLocals.

This post is a part of the &ldquo;Daily Reactive&rdquo; series of short posts about common situations with Project Reactor and Reactive Programming. ThreadLocals is one of the most common pain points topics nobody wants to talk about in the reactive world. Unlike in synchronous programming, asynchronous programming makes them hard to use due to a lot of context switching and thread pooling.…

Local development with Testcontainers

Testcontainers is a very helpful library when it comes to integration testing. One of the main benefits of it is that you can code your &ldquo;dependencies&rdquo; (like databases, brokers, cloud mocks, and other I/O sources) and start them with Docker from your tests - no need to run any additional command like docker-compose up or anything! But sometimes it is still useful to start your…

E2E test your Spring Boot 2.3.0 apps with Testcontainers

Spring Boot 2.3.0.M1 comes with a number of great features. I find one of them especially interesting - now you can build layered Docker images using Cloud Native Buildpacks! It is a very fast way of building Docker images compared to the Dockerfile approach thanks to Buildpacks. It is so fast that we can use it&hellip; to build, start and test our service as a Docker container (with…

Why you should never use fixed ports in your Testcontainers tests

I admit it - people are used to static ports. Web server? port 80! Redis? 6379! Java app? 8080! But let&rsquo;s be honest, the following also looks painfully familiar: Bind for 0.0.0.0:80 failed: port is already allocated. But there is more - localhost is the king! There was some disturbance back in the days of docker-machine (magical 192.168.99.100, anyone? Heck, I even wrote a tool that…

Daily Reactive: Pagination

This post is a part of the &ldquo;Daily Reactive&rdquo; series of short posts about common situations with Project Reactor and Reactive Programming. In one of the previous Daily Reactive posts we talked about the polling. Today we will focus on an interesting example of the polling: Pagination. Example Let&rsquo;s say we have the following API: interface Page extends Iterable<Item> {…

Daily Reactive: Splitting a stream

This post is a part of the &ldquo;Daily Reactive&rdquo; series of short posts about common situations with Project Reactor and Reactive Programming. Although it is not common, sometimes there is a need to split a Flux into a few. And one has to be careful to do it correctly! Let&rsquo;s say we have a stream of persons and we want to return a Tuple of names and ids:

Daily Reactive: Pollable sources

This post is a part of the &ldquo;Daily Reactive&rdquo; series of short posts about common situations with Project Reactor and Reactive Programming. Although streaming sources are very efficient with Reactive Streams, there are still many poll-based APIs. Kafka/Pulsar, REST, SQS/PubSub&hellip; You name it! Let&rsquo;s say we have the following blocking legacy API provided by the database: //…

Daily Reactive: Where is my exception?!

This post is a part of the &ldquo;Daily Reactive&rdquo; series of short posts about common situations with Project Reactor and Reactive Programming. Exceptions For Flow Contol? Throwing an error is a very easy way of terminating the processing. Consider the following example: public Mono<Void> sendRequest() { return doSendAndReceiveResponse() .doOnNext(buffer -> { throw new…

Daily Reactive: Hello world!

&ldquo;Daily Reactive&rdquo; is a series of posts about Reactive Programming and Project Reactor. The posts are inspired by some real world situations observed in Project Reactor&rsquo;s Gitter, or from working with the community, or even from the bug reports :) Learn from others and avoid the most common pitfalls! ℹ️ You can subscribe to the &ldquo;Daily Reactive&rdquo; only by using this RSS…

Zero-dependency Jackson entities with custom annotations

Jackson is a great library for working with JSON. However, it is a bit too heavyweight to have it as a public dependency of your API. Especially if you&rsquo;re working on an Open Source library. While refactoring docker-java, I got a challenge: There are two modules: api and core api module (unlike core) should not have any dependency core can be shaded, which means that we cannot use provided…

Use Java 13 syntax in GraalVM with Jabel

GraalVM&rsquo;s native-image is great, but (at least at the time this post was published) it only supports Java 8. Since Java 8, we got new language features like var, switch expressions, Milling of Project Coin and others. But, if we want to use these features, Java compiler leaves no option other than producing Java 12+ bytecode, even tho they don&rsquo;t need it and can be compiled to Java 8.

Re-running flaky tests in Gradle

The world is not perfect, so are the tests, and one day you will get&hellip; a flaky test 😱 Flaky&hellip; what? As per Nebojša Stričević: An essential property of an automated test and the entire test suite is its determinism. This means that a test should always have the same result when the tested code doesn’t change. A test that fails randomly is commonly called a flaky test.

Dependency Management in Gradle

There is one super popular thing I never did/do in my Gradle projects: ext { lib_version = '1.2.3' } dependencies { compile 'org.corp:lib:$lib_version' } Why not? I know that this approach was/is popular among Maven projects. But I always preferred the dependencyManagement section of a parent POM because&hellip; it is standartized. When you switch between projects and want to change a version of…

Detecting blocking calls in Akka with BlockHound

Asynchronous and non-blocking programming in JVM can provide very impressive performance results. Unlike the more classical blocking model, it runs on just a few threads from a pool. But, to keep it performant, you must ensure that you are not blocking these threads. Just imagine having 4 threads in total, and blocking one of them for 100 milliseconds? But how do you &ldquo;protect&rdquo; your…

The sad state of extension methods in the JVM ecosystem

Most of my time I write Java code. It isn&rsquo;t perfect, yet I find it good enough as my primary language. But sometimes I dream about the future of Java. Given the latest activities around the Java language design (See Project Amber), the future looks brighter JEP-by-JEP, but one feature I really miss which isn&rsquo;t discussed by Amber is&hellip; Extension methods. The problem Java language…

How to locally debug containers started by Testcontainers

One of the best things Docker gave us was the port randomization. You no longer have to care about possible conflicts, especially on CI environments. But it also created a big confusion for many users who got used to Redis listening on port 6379, or the Java debugger on 5005. Many tools are not container aware and expect things on static ports. Well, we can&rsquo;t change the whole world (yet),…

The Builder pattern vs Java syntax

The Builder pattern is one of the most popular patterns in Java. It is simple, helps to keep objects immutable, and can be generated with tools like Project Lombok&rsquo;s @Builder or Immutables, to name a few. Example of a fluent variant of the pattern: public class User { private final String firstName; private final String lastName; User(String firstName, String lastName) { this.firstName =…

My favourite GitHub bots

Year 2018 was an eye-opening year for me as an OSS project maintainer. The reason is due to the emerge of GitHub bots. Maintaining a project on GitHub could be a challenging task, especially when the project becomes popular. Issue management, releases, follow-ups, dependency management, oh my! But, as most of the developers, we&rsquo;re lazy enough and spend time automating things. Dependabot…

Easy Java delegates with Lombok

Ever wanted to override a method of an object instance in Java? Let&rsquo;s say you want to implement a custom Scheduler hook for Project Reactor. You start with Schedulers.addExecutorServiceDecorator, implement a BiFunction accepting Scheduler&rsquo;s instance and ScheduledExecutorService and you need to return another ScheduledExecutorService instance where schedule* methods wrapped with your…

JNI cross-compilation with Docker

As a JVM guy, I got used to &ldquo;write once, run everywhere&rdquo; paradigm. But recently I got an interesting challenge to solve. I was working on a debugging tool for Project Reactor and part of it is implemented as a native library for Java, using JNI technology. I did some C++ in the past but never thought how hard is it, to cross-compile a library for 3 major platforms (Windows, Linux and…