What if your text editor spoke Kafka?

If you work in enterprise software long enough, you may end up only looking at software that satisfies complex constraints: how often does it fail, what kind of security features does it have, does it work well with these other systems of ours, an so on. Not to forget the most common of them all: does it scale?

Under constant pressure of such requirements, one can slowly lose touch with the simplest use case for most software: a single human being trying to get some work done on whichever device they are currently using.

I found my own self in that situation recently. Having had to use Kafka, Storm and a variety of such frameworks that make life easier —or just plain possible — in complex scenarios, I then started wondering if any of this software can scale down instead of up / out. For example, let us consider knowledge workers of all kinds. What is the one simple activity that they are all bound to do? My bet is on typing letters into some kind of an editor. But hey, you can model that activity as a stream of characters entering some system. Enter Kafka.

Where would they be typing? Sticking to the basics again, it would be some text editing software running on their desktop. Enter Java Swing (ahem).

So I proceeded to rig up a Java Swing widget to a Kafka broker, directly using whatever Confluent (the company behind Kafka) provides as a quickstart. And I connected a couple of other editor instances to read off this Kafka broker. The result of that is what you see in this below animation (you can find the code and the instructions to run it on this Github repository).

Calling it an “editor” is a stretch, as all you can do is insert text. But I am still amazed at how much modern frameworks provide, out-of-the-box. All it took was a single command (“confluent start”), and I was off on my way writing Java code to send data between those editor windows 🙂

Leave a Reply
