Posts
Kafka With Spring
In the last blog we learned how to implement kafka consumer-publisher using plain kotlin. In this blog we’ll walk through some code to implement the same using Spring.
Spring makes the implementation rather simple. We need to create a configuration class and then we can add all our code there.
Setting up the configuration class We need two annotations for this Configuration and EnableKafka. We can also take some time to pick the value for bootstrapAddress and topic name from application.
Posts
Kafka With Kotlin
In this blog we’ll learn how to interact with a kafka broker using plain kotlin.
Generating a kafka project. For this we’re going to generate a spring project using spring initializer. Select the dependency Spring for Apache Kafka. We are adding this dependency so later on we can start using spring for our kafka interactions.
Spinning up kafka and zookeeper. Once you’ve generated your project you’ll need to spin up an instance of kafka and zookeeper.
Posts
Basics of Kafka
Kafka is a distributed event logging system. It’s widely used in event event driven system as framework of choice.
Events We learned about these the last time in Event Driven Systems. In kafka an event is represented by a key-value pair. A key can be null as well. Topics A topic is an ordered log A new event is appended to end of a topic. A topic is not a queue it’s a proper Log.
Posts
Event Driven Systems
A system which does something on the basis of a consumed event is considered an event driven system.
Event An event is defined as a “significant change in state”.
for sale -> sold interviewed -> hired low battery -> charging We can build a system that performs certain operation on basis of these state changes. Any and all state changes can be considered an event.
An event shouldn’t be confused with the message/data that we send with it.
Posts
Hallway
He was observing the night sky from the only window in this hallway, the moon was shining with it’s full strength. For the first few days he had found it quite charming but now it felt lifeless. You can look out of this window at any time this is the exact same view you’ll find. The moon shining and nothing else, there were no clouds and his window was too high to see anything on the ground.
Posts
Create your react component
Creating your own react component is supereasy.
Syntax class MyElement extends React.Component { constructor(props) { super(props); } render() { return react.createElement('p',null,'This is some text'); } } Or const myElement = (props) =>{ return react.createElement('p',null,'This is some text') } Here we have seen two ways to create a react component one using classes the other using simple arrow function.
How to use it const myElement = react.createElement(MyElement); root.render(myElement); Two important things happen here.
Posts
Intro to react
React is a frontend javascript framework which allows us to decouple the logic and rederning of an element in DOM.
Creating an React Element React.createElement('Element name', props, ...children) Mounting a React Elment After creating an element you will need a place to mount the element until then the element you created will not be present in HTML DOM.
The element you will mount your react element to is called root.
Posts
Son of Dharma
The sun is blazing, you can hear the birds in the nearby forest. Young Yundhishtira is out in his chariot alone. A single horse is pulling this chariot, Yudhishtira is going through the forest without much attention, his thoughts are occupied by the strategies he can use to win a game of dice. He’s planning to ask his uncle vidura to join him for another game tonight. He’s smiling thinking about winning tonight’s game.
Posts
Bhima
Bhima then book written by MT Vasudevan Nair is Mahabharata told from the perspective of bhima the second brother.
Beginning Bhima opens with the Pandavas in the middle of their journey to Mount Meru. When Draupadi has just fallen but none of the Pandava brother seem to care. Not the son of Dharma, Yudhishthira nor the Arjuna whom draupadi loves the most. Even Nakula and Sehdeva seem to not care for the women who’ve been like a mother to them for most of their life.
Posts
Generics in java
Generics in java are used to specify a type which would be known only when the code is ran or called not when it is written.
Generic also helps you to write code that can work with wide variety of types. So you don’t need to overload a function uneccesarily.
Syntax for classes class Box<T> { } class Pencil { } // Class creation Box<Pencil> = new Box<Pencil>(); In the example above we are creating a generic class and we are telling a type T will be given at call time in the example above we created a class Box and at call time we provided a class Pencil.