In Chapter 1, we explored the idea of representing data as a series of events. This idea applies not only if you want to keep track of things that happened (e.g., page views in an analytics application), but we also saw that events work well for describing changes to a database (event sourcing).
However, so far we have been a bit vague about what the stream should look like. In this chapter, we will explore the answer in detail: a stream should be implemented as a log; that is, an append-only sequence of events in a fixed order. (This is what Apache Kafka does.)
It turns out that the ordering of events is really important, and many systems (such as AMQP or JMS message queues) do not provide a fixed ordering. In this chapter, we will go on a few digressions outside of stream processing, to look at logs appearing in other places: in database storage engines, in database replication, and even in distributed consensus systems.
Then, we will take what we have learned from those other areas of computing and apply it to stream processing. Those lessons will help us build applications that are operationally robust, reliable, and that perform well.
But before we get into logs, we will begin this chapter with a motivating example: the sprawling complexity of data integration in a large application. If you work on a non-trivial application—something with more than just one database—you’ll probably find these ideas very useful. (Spoiler: ...