<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shivangi Chandra on Medium]]></title>
        <description><![CDATA[Stories by Shivangi Chandra on Medium]]></description>
        <link>https://medium.com/@shivangichandra806?source=rss-f57e74189ae0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*L1tJozerPuppXUii</url>
            <title>Stories by Shivangi Chandra on Medium</title>
            <link>https://medium.com/@shivangichandra806?source=rss-f57e74189ae0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 16:37:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shivangichandra806/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Complete Beginner’s Guide to Docker]]></title>
            <link>https://medium.com/@shivangichandra806/complete-beginners-guide-to-docker-2991d4481eee?source=rss-f57e74189ae0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2991d4481eee</guid>
            <dc:creator><![CDATA[Shivangi Chandra]]></dc:creator>
            <pubDate>Fri, 14 Feb 2025 11:02:48 GMT</pubDate>
            <atom:updated>2025-02-14T11:02:48.555Z</atom:updated>
            <content:encoded><![CDATA[<h3>A begineer Guide 🎬</h3><p>Docker has revolutionized the way developers build, ship, and run applications. Whether you’re a seasoned developer or just starting out, Docker can simplify your workflow by using containers to isolate and run applications in different environments. In this article, we’ll break down Docker into easy-to-understand sections, explore its key concepts, and walk you through practical examples to get you started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xdji8_Tw9KMMDbr4D-GMBA.png" /></figure><h3>What is Docker ? 🧐</h3><p>Docker is a platform designed to make it easier to develop, test, and deploy applications by using <strong>containers</strong>. A container is a lightweight, portable, and self-sufficient unit that packages everything your application needs — code, libraries, dependencies, and settings — into a single, consistent environment. This means that no matter where you run your container (on your laptop, a test server, or in production), the environment will be exactly the same.</p><p>Think of Docker as a shipping container for your software. Just as shipping containers standardize the transportation of goods, Docker containers standardize the deployment of applications.</p><h3>Virtual Machines vs. Docker Containers</h3><p>At first glance, Docker containers might seem similar to <strong>virtual machines (VMs)</strong>, but they are fundamentally different. Here’s a quick comparison:</p><ul><li><strong>Virtual Machines (VMs):</strong> VMs virtualize the entire operating system, including the kernel, which makes them heavy and slow to start.</li><li><strong>Docker Containers:</strong> Containers share the host OS’s kernel, making them much lighter and faster. They only include the application and its dependencies, not the entire OS.</li></ul><p>This key difference makes Docker containers more efficient and ideal for modern, scalable applications.</p><h3>Key Docker Concepts 🔐</h3><h4>1. Container</h4><p>A container is a running instance of a Docker image. It’s an isolated environment where your application runs. Think of it as a mini-server with its own filesystem, network, and resources.</p><h4>2. Docker Image</h4><p>A Docker image is a <strong>snapshot</strong> or <strong>template</strong> that contains everything needed to run an application — your code, libraries, dependencies, and system settings. For example:</p><ul><li>Your application code (e.g., a Node.js app)</li><li>Required software (e.g., Node.js, npm)</li><li>OS layer (e.g., Linux)</li></ul><h4>3. Artifact</h4><p>An artifact in Docker refers to the packaged result of your application, which is ready to be shared or deployed. It’s essentially the Docker image.</p><h3>Docker Image vs. Docker Container</h3><ul><li><strong>Docker Image:</strong> A static, read-only blueprint of your app.</li><li><strong>Docker Container:</strong> A live, running instance of that image.</li></ul><h3>Docker Ecosystem Flow</h3><p>The Docker ecosystem revolves around the following components:</p><ol><li><strong>Docker Hub:</strong> A public repository where you can find Docker images, including official ones (like NGINX, MongoDB, etc.).</li><li><strong>Docker Registry:</strong> A service for storing Docker images. Docker Hub is one of the most popular registries.</li><li><strong>Docker Repository:</strong> A collection of images for a specific application. A repository can have multiple versions (e.g., nginx:latest, nginx:alpine).</li></ol><h3>Practical Example: Running NGINX with Docker</h3><p>Let’s dive into a practical example by running an <strong>NGINX</strong> web server using Docker.</p><h4>1. Pull the NGINX Image</h4><p>If you don’t have the image locally, Docker will pull it from Docker Hub.</p><pre>docker run nginx:bookworm</pre><h4>2. Run the Container in Detached Mode</h4><p>By default, containers run on their own isolated network. You need to map ports to access it from your local machine.</p><pre>docker run -d -p 8080:80 nginx:bookworm</pre><ul><li>-d: Run the container in detached mode (in the background).</li><li>-p 8080:80: Map port 8080 on your local machine to port 80 inside the container.</li></ul><h4>3. Access NGINX</h4><p>Open your browser and go to http://localhost:8080 to see the NGINX welcome page. You will see something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SGbIxi1RWQ4NWNmjPNzeDw.png" /></figure><blockquote>Note: If you are unable to see this output, try changing your port from 8080 to a different one that is not being used by any other process.</blockquote><h3>Creating Your Own Docker Image</h3><p>If you don’t already have a Node.js app, here’s a simple one:</p><h4>1. <strong>Create a Node.js App</strong></h4><p><strong>I. Create a folder</strong> for your project:</p><ul><li>mkdir my-node-app</li><li>cd my-node-app</li></ul><p><strong>II. Create a </strong><strong>server.js file</strong> in the my-node-app folder:</p><pre>const http = require(&#39;http&#39;);<br><br>const server = http.createServer((req, res) =&gt; {<br>    res.writeHead(200, { &#39;Content-Type&#39;: &#39;text/plain&#39; });<br>    res.end(&#39;Hello, Docker!&#39;);<br>});<br><br>server.listen(4000, () =&gt; {<br>    console.log(&#39;Server is running on port 4000&#39;);<br>});</pre><p><strong>III. Initialize Node.js project</strong>:</p><ul><li>npm init -y</li></ul><h4>2. Create the Dockerfile</h4><ol><li><strong>Create a file named </strong><strong>Dockerfile (no extension)</strong> in your project folder (my-node-app).</li><li>Add the following content in <strong>Dockerfile :</strong></li></ol><pre># Use the official Node.js image<br>FROM node:20<br><br># Set the working directory<br>WORKDIR /app<br><br># Copy package.json and install dependencies<br>COPY package.json /app/<br>RUN npm install<br><br># Copy the rest of the app&#39;s files<br>COPY . /app/<br><br># Expose port 4000<br>EXPOSE 4000<br><br># Run the app<br>CMD [&quot;node&quot;, &quot;server.js&quot;]</pre><h4>3. Build the Docker Image</h4><p>Run this command in your terminal from the project folder to build your image:</p><pre>docker build -t node-app:1.0 .</pre><h4>4. Run the Docker Container</h4><p>Run the container with the following command:</p><pre>docker run -p 4000:4000 node-app:1.0</pre><h4>5. Access Your App</h4><p>Open your browser and go to:<br>http://localhost:4000</p><p>You should see the message Hello, Docker!. 🥳</p><h3>Private vs. Public Registries</h3><h3>Public Registry (e.g., Docker Hub)</h3><p>Docker Hub is a public registry where you can find and share Docker images for free. Example: Official images like nginx, mysql, redis.</p><h3>Private Registry</h3><p>Used for storing images that are private to your organization. Requires authentication to access.</p><h3>Common Docker Commands 📚</h3><p>Here are some essential Docker commands you’ll use frequently:</p><ul><li><strong>Build a Docker image:</strong> Build an image from a Dockerfile.</li></ul><pre>docker build -t &lt;name&gt;:&lt;tag&gt; .</pre><ul><li><strong>Run a Docker container:</strong> Run a container with port mapping.</li></ul><pre>docker run -p &lt;host-port&gt;:&lt;container-port&gt; &lt;image&gt;</pre><ul><li><strong>List all containers:</strong> View all containers (running or stopped).</li></ul><pre>docker ps -a</pre><ul><li><strong>Stop a running container:</strong> Stop a container by its ID or name.</li></ul><pre>docker stop &lt;container-id&gt;</pre><ul><li><strong>Remove a stopped container:</strong> Delete a container once it’s stopped.</li></ul><pre>docker rm &lt;container-id&gt;</pre><ul><li><strong>Remove a Docker image:</strong> Delete an image by its ID.</li></ul><pre>docker rmi &lt;image-id&gt;</pre><h3>Why Use Docker?</h3><p>Docker brings a lot of benefits to software development and deployment:</p><ul><li><strong>Consistency:</strong> The same Docker container will run the same way across any environment — whether it’s your laptop, a staging server, or production.</li><li><strong>Efficiency:</strong> Containers are lightweight and start up quickly.</li><li><strong>Isolation:</strong> You can run multiple versions of an app on the same machine without conflicts.</li><li><strong>Simplified Deployment:</strong> Docker allows for easy deployment and scaling of apps in production environments, especially for microservices.</li></ul><h3>Conclusion</h3><p>Docker is a powerful tool that revolutionizes how we build, test, and deploy software. By containerizing your applications, you ensure consistent environments, simplify dependencies, and speed up deployment. Whether you’re running basic web servers like NGINX or creating custom applications with Node.js, Docker simplifies the entire process.</p><p>With a few simple commands and the core concepts covered in this article, you can start containerizing your applications today.</p><h3>Ready to Dive Deeper ? 🏄‍♂️</h3><p>If you want to explore more advanced topics like Docker, stay tuned for future articles. Let me know in the comments what you’d like to learn next!</p><p><strong>Happy Dockering !</strong>😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2991d4481eee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka from Scratch]]></title>
            <link>https://medium.com/@shivangichandra806/kafka-from-scratch-106a1c02f8ce?source=rss-f57e74189ae0------2</link>
            <guid isPermaLink="false">https://medium.com/p/106a1c02f8ce</guid>
            <dc:creator><![CDATA[Shivangi Chandra]]></dc:creator>
            <pubDate>Sun, 02 Feb 2025 14:17:15 GMT</pubDate>
            <atom:updated>2025-02-02T14:19:41.720Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Real-Time Data Pipelines</h3><p>In today’s data-driven world, businesses must process and analyze vast amounts of data in real time. Apache Kafka is a leading solution for handling high-volume, real-time data streams. Whether it’s fraud detection, activity tracking, or IoT device monitoring, Kafka provides a robust framework for building real-time data pipelines. In this article, we’ll explore what Kafka is, why it’s important, and how it works.</p><h3>What is Kafka?</h3><p>Apache Kafka is a distributed streaming platform designed to handle real-time data feeds with high throughput and low latency. It operates on a publish-subscribe model, where producers publish data to topics, and consumers subscribe to those topics to process the data. Kafka is not a storage system but a real-time data processing engine that enables seamless data streaming and transformation.</p><h3>Key Features of Kafka:</h3><ol><li><strong>Real-Time Data Processing</strong>: Kafka processes data streams in real time, making it ideal for use cases like fraud detection, log aggregation, and monitoring.</li><li><strong>Distributed Commit Logs</strong>: Kafka acts as a distributed commit log, recording events as they happen in microservices applications. These events are logged across multiple topics.</li><li><strong>Streaming APIs</strong>: Kafka provides APIs for stream processing, enabling operations like grouping, aggregation, filtering, and joining.</li><li><strong>Scalability and Fault Tolerance</strong>: Kafka is designed to scale horizontally, with multiple brokers working in parallel. If one broker fails, others take over, ensuring high availability.</li><li><strong>Multiple Producers and Consumers</strong>: Kafka supports various producers and consumers simultaneously. Once a consumer reads data, it remains available for other consumers to process later.</li></ol><h3>Why Use Kafka?</h3><p>Kafka’s popularity stems from its ability to address critical challenges in modern data architectures:</p><ol><li><strong>Scalability</strong>: Kafka can handle massive data loads by distributing workloads across multiple brokers.</li><li><strong>High Availability</strong>: With replication and fault tolerance, Kafka ensures data is always accessible, even if a broker goes down.</li><li><strong>Real-Time Activity Tracking</strong>: Kafka enables real-time monitoring of activities, such as tracking vehicles (cars, trucks, ships) or IoT devices.</li><li><strong>Stream Processing</strong>: Kafka allows for real-time data transformation and processing at each step of the pipeline.</li><li><strong>Foundation for Big Data Platforms</strong>: Kafka serves as the backbone for many big data platforms and event-driven microservices applications.</li></ol><h3>Where is Kafka Used?</h3><p>Kafka is widely adopted across industries and use cases:</p><ul><li><strong>Social Media</strong>: Twitter uses Kafka for real-time data processing and activity streams.</li><li><strong>Ride-sharing</strong>: Uber relies on Kafka for tracking rides and processing real-time data.</li><li><strong>Entertainment</strong>: Netflix uses Kafka for real-time recommendations and monitoring.</li><li><strong>E-Commerce</strong>: Pinterest leverages Kafka for real-time analytics and ad targeting.</li><li><strong>IoT</strong>: Kafka is used to process data from IoT devices, enabling real-time monitoring and decision-making.</li></ul><h3>Kafka Architecture</h3><p>Kafka’s architecture is built around several key components:</p><ol><li><strong>Broker</strong>: A Kafka server that stores data and serves client requests.</li><li><strong>Zookeeper</strong>: Manages and coordinates Kafka brokers, ensuring cluster stability.</li><li><strong>Producer</strong>: Publishes data to Kafka topics.</li><li><strong>Consumer</strong>: Subscribes to topics and processes the data.</li><li><strong>Topic</strong>: A category or feed name to which records are sent.</li><li><strong>Partition</strong>: Topics are divided into partitions for scalability and parallelism.</li><li><strong>Replicas</strong>: Copies of partitions stored on multiple brokers for fault tolerance.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*itvrmeBhaFxK4SbhQF5O-A.png" /></figure><h3>How Kafka Works</h3><p><strong>Producer Workflow</strong></p><p><strong>1 . Producer Record</strong>: The producer creates a record with key-value pairs and specifies the topic and partition.</p><p><strong>2. Serializer</strong>: Converts the key and value from Java types to byte arrays (e.g., using Avro).</p><p><strong>3. Partitioner</strong>: Determines which partition the record should be written to. If no key is provided, Kafka uses a round-robin approach.</p><p><strong>4. Kafka Brokers</strong>: The record is sent to the appropriate broker using the TCP protocol.</p><p>A message begins with a Producer Record.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0o9XwOoMd4VLxFXWama7lw.png" /></figure><p><strong>Consumer Workflow</strong></p><ol><li><strong>Subscription</strong>: Consumers subscribe to one or more topics.</li><li><strong>Partition Ownership</strong>: Each consumer is assigned a partition, ensuring load balancing.</li><li><strong>Offset Management</strong>: Kafka tracks the offset (position) of each consumer in the partition.</li><li><strong>Data Processing</strong>: Consumers process the data and can re-read it if needed.</li></ol><h3>Kafka Records</h3><p>A Kafka record consists of seven attributes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lCjn99NQg7O0Qe6MHefeXg.png" /></figure><ol><li><strong>Topic</strong>: The topic to which the record belongs.</li><li><strong>Partition</strong>: The partition within the topic (0-based index).</li><li><strong>Offset</strong>: A 64-bit identifier indicating the record’s position in the partition.</li><li><strong>Timestamp</strong>: The time when the record was created.</li><li><strong>Key</strong>: An optional, non-unique identifier (array of bytes).</li><li><strong>Headers</strong>: Optional metadata (key-value pairs).</li><li><strong>Value</strong>: The actual payload (array of bytes).</li></ol><p>The combination of partition number and key forms a composite primary key, uniquely identifying each record.</p><h3>Kafka in Action: Running Kafka Producer and Consumer Code in IntelliJ IDEA Using Maven</h3><p>If you’re using IntelliJ IDEA and Maven to manage your Kafka project, running your Kafka producer and consumer code is straightforward. In this section, we’ll walk you through the steps to compile and run the KafkaProducerExample.java and KafkaConsumerExample.java files using IntelliJ IDEA.</p><blockquote>NOTE : If you’re having trouble setting up your project, you can also check out my article on <strong>Spring Boot Initializer</strong> for a step-by-step guide on creating and configuring a Spring Boot project. It will walk you through the process and help you get started quickly. You can find the article <a href="https://medium.com/@shivangichandra806/new-to-java-spring-boot-b940299fbda2">here</a> .🚀</blockquote><h3>Step 1: Project Setup in IntelliJ IDEA</h3><ol><li><strong>Create a Maven Project</strong>:</li></ol><ul><li>Open IntelliJ IDEA and create a new Maven project.</li><li>Follow the prompts to set up your project with a groupId and artifactId.</li></ul><ol><li><strong>Add Kafka Dependencies</strong>:</li></ol><ul><li>Open the pom.xml file and add the Kafka client dependency:</li></ul><pre>&lt;dependencies&gt; &lt;dependency&gt; <br>&lt;groupId&gt;org.apache.kafka&lt;/groupId&gt; <br>&lt;artifactId&gt;kafka-clients&lt;/artifactId&gt; <br>&lt;version&gt;3.4.0&lt;/version&gt; <br>&lt;! - Use the latest version - &gt; <br>&lt;/dependency&gt; &lt;/dependencies&gt;</pre><ul><li>Save the pom.xml file. IntelliJ IDEA will automatically download the required dependencies.</li></ul><ol><li><strong>Create Java Files</strong>:</li></ol><ul><li>Navigate to the src/main/java directory in your project.</li><li>Create two Java files: KafkaProducerExample.java and KafkaConsumerExample.java.</li><li>Copy and paste the below code into respective files.</li></ul><p><strong>Kafka Producer Code :</strong></p><pre>import org.apache.kafka.clients.producer.*;<br>import java.util.Properties;<br><br>public class KafkaProducerExample {<br>    public static void main(String[] args) {<br>        // Step 1: Configure the producer<br>        Properties props = new Properties();<br>        props.put(&quot;bootstrap.servers&quot;, &quot;localhost:9092&quot;); // Kafka broker address<br>        props.put(&quot;key.serializer&quot;, &quot;org.apache.kafka.common.serialization.StringSerializer&quot;);<br>        props.put(&quot;value.serializer&quot;, &quot;org.apache.kafka.common.serialization.StringSerializer&quot;);<br><br>        // Step 2: Create the producer<br>        Producer&lt;String, String&gt; producer = new KafkaProducer&lt;&gt;(props);<br><br>        // Step 3: Create a producer record<br>        ProducerRecord&lt;String, String&gt; record = new ProducerRecord&lt;&gt;(&quot;my_topic&quot;, &quot;key&quot;, &quot;Hello, Kafka!&quot;);<br><br>        // Step 4: Send the record<br>        producer.send(record, new Callback() {<br>            @Override<br>            public void onCompletion(RecordMetadata metadata, Exception exception) {<br>                if (exception == null) {<br>                    System.out.println(&quot;Message sent successfully to partition &quot; + metadata.partition());<br>                } else {<br>                    exception.printStackTrace();<br>                }<br>            }<br>        });<br><br>        // Step 5: Close the producer<br>        producer.close();<br>    }<br>}</pre><p><strong>Kafka Consumer Code :</strong></p><pre>import org.apache.kafka.clients.consumer.*;<br>import org.apache.kafka.common.TopicPartition;<br>import java.time.Duration;<br>import java.util.Collections;<br>import java.util.Properties;<br><br>public class KafkaConsumerExample {<br>    public static void main(String[] args) {<br>        // Step 1: Configure the consumer<br>        Properties props = new Properties();<br>        props.put(&quot;bootstrap.servers&quot;, &quot;localhost:9092&quot;); // Kafka broker address<br>        props.put(&quot;group.id&quot;, &quot;test-group&quot;); // Consumer group ID<br>        props.put(&quot;key.deserializer&quot;, &quot;org.apache.kafka.common.serialization.StringDeserializer&quot;);<br>        props.put(&quot;value.deserializer&quot;, &quot;org.apache.kafka.common.serialization.StringDeserializer&quot;);<br><br>        // Step 2: Create the consumer<br>        Consumer&lt;String, String&gt; consumer = new KafkaConsumer&lt;&gt;(props);<br><br>        // Step 3: Subscribe to the topic<br>        consumer.subscribe(Collections.singletonList(&quot;my_topic&quot;));<br><br>        // Step 4: Poll for new messages<br>        while (true) {<br>            ConsumerRecords&lt;String, String&gt; records = consumer.poll(Duration.ofMillis(100));<br>            for (ConsumerRecord&lt;String, String&gt; record : records) {<br>                System.out.printf(&quot;Received message: key = %s, value = %s, partition = %d, offset = %d%n&quot;,<br>                        record.key(), record.value(), record.partition(), record.offset());<br>            }<br>        }<br>    }<br>}</pre><h3>Step 2: Compile the Code</h3><p>IntelliJ IDEA automatically compiles your code as you save changes. However, if you want to manually compile the project:</p><p><strong>1. Build the Project</strong>:</p><ul><li>Go to the top menu and click on <strong>Build</strong> &gt; <strong>Build Project</strong>.</li><li>Alternatively, use the shortcut Ctrl + F9 (Windows/Linux) or Cmd + F9 (Mac).</li></ul><p><strong>2. Check for Errors</strong>:</p><ul><li>If there are any compilation errors, IntelliJ IDEA will highlight them in the editor. Fix the errors before proceeding.</li></ul><h3>Step 3: Run the Kafka Producer</h3><p><strong>1. Open </strong><strong>KafkaProducerExample.java</strong>:</p><ul><li>Navigate to the KafkaProducerExample.java file in the src/main/java directory.</li></ul><p><strong>2. Run the Producer</strong>:</p><ul><li>Right-click anywhere in the editor and select <strong>Run “KafkaProducerExample.main()”</strong>.</li></ul><p><strong>3. Verify the Output</strong>:</p><ul><li>If the producer runs successfully, you’ll see the following output in the Run console:</li></ul><pre>Message sent successfully to partition 0</pre><h3>Step 4: Run the Kafka Consumer</h3><p><strong>1. Open </strong><strong>KafkaConsumerExample.java</strong>:</p><ul><li>Navigate to the KafkaConsumerExample.java file in the src/main/java directory.</li></ul><p><strong>2. Run the Consumer</strong>:</p><ul><li>Right-click anywhere in the editor and select <strong>Run ‘KafkaConsumerExample.main()’</strong>.</li><li>Alternatively, click the green play button ▶️ next to the main method.</li></ul><p><strong>3. Verify the Output</strong>:</p><ul><li>The consumer will start polling for messages. If the producer has already sent a message, you’ll see the following output in the Run console:</li></ul><pre>Received message: key = key, value = Hello, Kafka!, partition = 0, offset = 0</pre><h3>Step 5: Running Both Producer and Consumer Together</h3><p>To see the producer and consumer in action simultaneously:</p><p><strong>1. Run the Producer</strong>:</p><ul><li>Run the KafkaProducerExample class as described above.</li></ul><p><strong>2. Run the Consumer</strong>:</p><ul><li>Run the KafkaConsumerExample class in a separate instance of IntelliJ IDEA or a new terminal window.</li></ul><p><strong>3. Observe the Flow</strong>:</p><ul><li>The producer will send a message to the my_topic topic.</li><li>The consumer will receive and print the message in real time.</li></ul><h3>Inference :</h3><p>Apache Kafka is a powerful tool for building real-time data pipelines and processing high-volume data streams. Its distributed architecture, scalability, and fault tolerance make it a go-to solution for modern data-driven applications. Whether you’re tracking IoT devices, detecting fraud, or analyzing user activity, Kafka provides the foundation for real-time data processing.</p><p>By understanding Kafka’s architecture, workflows, and use cases, you can leverage its capabilities to build robust, scalable, and efficient data pipelines. So, dive into Kafka and unlock the potential of real-time data streaming!</p><p>Do follow ! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=106a1c02f8ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New to Java Spring Boot]]></title>
            <link>https://medium.com/@shivangichandra806/new-to-java-spring-boot-b940299fbda2?source=rss-f57e74189ae0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b940299fbda2</guid>
            <dc:creator><![CDATA[Shivangi Chandra]]></dc:creator>
            <pubDate>Sun, 02 Feb 2025 14:16:48 GMT</pubDate>
            <atom:updated>2025-02-02T14:21:01.226Z</atom:updated>
            <content:encoded><![CDATA[<h3>Diving Deeper into Java: Exploring Spring, Spring Boot, and the Spring Framework</h3><p>If you’re new to Java Spring Boot or looking to deepen your understanding of the Spring ecosystem, this guide will help you get started. We’ll explore the basics of Spring, the need for frameworks in Java development, and how Spring Boot simplifies the process of building robust applications.</p><h3>Pre-requisites: What You Need to Know</h3><p>Before diving into Spring, ensure you’re comfortable with the following Java concepts:</p><ol><li><strong>Core Java</strong>:</li></ol><ul><li>Object-Oriented Programming (OOP) concepts: Inheritance, Polymorphism, Encapsulation, and Abstraction.</li><li>Collections Framework: Lists, Sets, Maps, etc.</li><li>Exception Handling: Try-catch blocks, custom exceptions.</li><li>Input/Output Operations: File handling, streams.</li></ul><p><strong>2. Java 8+ Features</strong>:</p><ul><li>Lambda Expressions: Simplify code with functional programming.</li><li>Streams API: Process collections efficiently.</li><li>New Date/Time API: Modern date and time handling.</li></ul><h3>Why Frameworks Are Important in Java Development</h3><p>Frameworks provide a structured way to build applications, reducing boilerplate code and improving productivity. They offer reusable components, enforce best practices, and simplify complex tasks like dependency management, database interactions, and security.</p><h3>Introduction to Spring</h3><h3>What is Spring?</h3><p>Spring is a powerful, lightweight, open-source framework for building enterprise-grade Java applications. It provides comprehensive infrastructure support for developing robust applications.</p><h3>Why Do We Need Spring?</h3><ul><li><strong>Dependency Injection (DI)</strong>: Promotes loose coupling and easier testing.</li><li><strong>Modularity</strong>: Use only the modules you need (e.g., Spring MVC, Spring Data, Spring Security).</li><li><strong>Integration</strong>: Seamlessly integrates with other technologies like Hibernate, JPA, and RESTful services.</li></ul><h3>History of Spring</h3><p>Spring was first released in 2003 by Rod Johnson. It has since evolved into a vast ecosystem, with Spring Boot being one of its most popular projects.</p><h3>Key Features of Spring</h3><ul><li>Dependency Injection (DI) and Inversion of Control (IoC).</li><li>Aspect-Oriented Programming (AOP) for cross-cutting concerns.</li><li>Support for transaction management, data access, and messaging.</li><li>Extensive integration with other frameworks and libraries.</li></ul><h3>Spring Boot: Simplifying Spring Development</h3><h3>What is Spring Boot?</h3><p>Spring Boot is an open-source framework built on top of the Spring Framework. It simplifies the development of standalone, production-grade Spring-based applications with minimal configuration.</p><h3>Why Do We Need Spring Boot?</h3><ul><li><strong>Convention Over Configuration</strong>: Reduces the need for manual setup.</li><li><strong>Rapid Development</strong>: Enables quick prototyping and deployment.</li><li><strong>Embedded Servers</strong>: Comes with embedded Tomcat, Jetty, or Undertow servers.</li></ul><h3>History of Spring Boot</h3><p>Spring Boot was released in 2014 by Pivotal Software (now part of VMware). It has quickly become the go-to framework for modern Java development.</p><h3>Key Features of Spring Boot</h3><ol><li><strong>Convention Over Configuration</strong>: Default settings reduce the need for explicit configuration.</li><li><strong>Opinionated Approach</strong>: Provides sensible defaults for quick setup.</li><li><strong>Starter Dependencies</strong>: Pre-packaged dependencies for common use cases (e.g., spring-boot-starter-web for web applications).</li><li><strong>Auto-Configuration</strong>: Automatically configures beans and settings based on the classpath.</li></ol><h3>Use Cases of Spring Boot</h3><ul><li>Web Applications</li><li>RESTful Web Services</li><li>Microservices</li><li>Batch Processing</li><li>Integration with Other Technologies</li><li>Testing, Monitoring, and Management</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*izotjGf-tnjE_frF-0EYvA.png" /></figure><h3>Let’s Dive Deeper into Spring Boot</h3><h3>1. Setting Up the Environment</h3><ul><li><strong>IDE</strong>: Install IntelliJ IDEA or Eclipse for development.</li><li><strong>Build Tools</strong>: Learn Maven or Gradle for dependency management and project builds.</li></ul><h3>2. Understanding the Spring Framework</h3><p>Before diving into Spring Boot, familiarize yourself with these core Spring concepts:</p><ul><li><strong>Dependency Injection (DI)</strong>: Learn how Spring manages object dependencies.</li><li><strong>Spring Beans and Container</strong>: Understand the lifecycle of beans and how the Spring container manages them.</li><li><strong>Aspect-Oriented Programming (AOP)</strong>: Separate cross-cutting concerns like logging and security.</li></ul><h3>3. Spring Boot Basics</h3><ul><li><strong>Starters</strong>: Use Spring Boot starters (e.g., spring-boot-starter-web) to add dependencies for specific functionalities.</li><li><strong>Auto-Configuration</strong>: Spring Boot automatically configures beans based on the dependencies in your classpath.</li><li><strong>Spring Boot CLI</strong>: Install the Spring Boot Command Line Interface (CLI) for quick prototyping.</li></ul><h3>4. Building Your First Project</h3><ul><li><strong>Spring Initializr</strong>: Use <a href="https://start.spring.io/">Spring Initializr</a> to generate a new Spring Boot project.</li><li><strong>Annotations</strong>: Learn essential annotations like @SpringBootApplication, @RestController, and @Autowired.</li><li><strong>Configuration</strong>: Configure your application using application.properties or application.yml.</li></ul><h3>5. Additional Topics to Explore</h3><ul><li><strong>Spring Data JPA</strong>: Simplify database interactions.</li><li><strong>Spring Security</strong>: Secure your applications with authentication and authorization.</li><li><strong>Testing</strong>: Use JUnit and Mockito for unit and integration testing.</li><li><strong>RESTful Services</strong>: Build RESTful APIs with Spring MVC.</li></ul><h3>Resources for Learning Spring and Spring Boot</h3><ol><li><strong>Official Documentation</strong>: <a href="https://spring.io/projects/spring-boot">Spring Docs</a></li><li><strong>Books</strong>:</li></ol><ul><li><em>“Spring in Action”</em> by Craig Walls.</li><li><em>“Spring Boot: Up and Running”</em> by Mark Heckler.</li></ul><p><strong>3. Online Courses</strong>:</p><ul><li>Udemy: <em>“Spring &amp; Hibernate for Beginners”</em> by Chad Darby.</li><li>Coursera: <em>“Building Cloud Services with Spring Boot”</em> by Vanderbilt University.</li><li>Pluralsight: <em>“Spring Boot Fundamentals”</em> by Bryan Hansen.</li></ul><h3>Conclusion</h3><p>Spring Boot is a game-changer for Java developers, enabling rapid development of modern applications with minimal setup. By mastering the Spring Framework and Spring Boot, you’ll be well-equipped to build scalable, maintainable, and production-ready applications. Start small, explore the ecosystem, and happy coding! 🚀</p><p>This version is well-organized, easy to follow, and includes all the necessary details for someone new to Spring and Spring Boot.</p><p>Do Follow !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b940299fbda2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[APIs Demystified: How Different Systems Speak a Common Language]]></title>
            <link>https://medium.com/@shivangichandra806/apis-demystified-how-different-systems-speak-a-common-language-31bbb8e3e58f?source=rss-f57e74189ae0------2</link>
            <guid isPermaLink="false">https://medium.com/p/31bbb8e3e58f</guid>
            <dc:creator><![CDATA[Shivangi Chandra]]></dc:creator>
            <pubDate>Sat, 21 Dec 2024 15:10:44 GMT</pubDate>
            <atom:updated>2024-12-21T15:13:54.344Z</atom:updated>
            <content:encoded><![CDATA[<h4>1. Introduction: What is an API ? 🤔</h4><ul><li>Application Programming Interface.😂</li><li><em>“Imagine a world 🌐 where everyone speaks a different language, but there’s a shopkeeper who understands them all. That’s what APIs are for software — the universal translator.”</em></li><li><em>“APIs are like digital bridges, helping different systems, applications, or devices communicate seamlessly with one another.”</em></li><li>It’s like people speaking different languages, with a translator in between connecting them.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Co3F0oXYOX0mzi7vNYnIOg.png" /></figure><h4>2. Why APIs are the Backbone of Modern Applications</h4><ul><li>APIs handle “what to talk” (<strong>data</strong>) and “how to talk” (<strong>protocol</strong>).</li><li>“Using an API is like ordering food at a restaurant: you request specific items, and the waiter delivers them without explaining how the kitchen operates.”</li><li>In software development, this includes scenarios such as a React frontend communicating with a Python backend, interactions between different websites, and the connection between mobile apps and servers.</li><li>Everyday examples like “Login with Google” , or weather apps .</li><li><em>“When you log in with Google, you don’t worry about Google’s verification process; you trust it. That’s the magic of APIs — they handle the hard part, so you don’t have to.”</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*cD8Eo2cXmaFpl_gdLw0_QQ.png" /></figure><ul><li>The API acts as a <strong>bridge </strong>here<strong> </strong>in<strong> </strong>this process, defining the rules and methods for communication between the client app, the authorization server, and the custom UI. It ensures that the client app can securely request access, the server can verify credentials, and a token or authorization code is returned. The API handles the entire flow of data exchange, ensuring security, standardization, and seamless interaction between systems without exposing sensitive user credentials.</li></ul><h4>3. The Two Pillars of API Communication</h4><ul><li><strong>💻Data</strong> : APIs define how data is structured (e.g., JSON, XML).</li><li><strong>🛑Protocol</strong> : APIs decide communication methods (e.g., REST, GraphQL).</li><li><em>“APIs define the rules of engagement — the data we send and receive, and the format we use. It’s like agreeing on a common script before a play starts.”</em></li><li><em>“REST protocol is like a waiter taking your order at a restaurant, while GraphQL protocol is like a buffet where you choose exactly what you want.”</em></li><li>You can check more about REST and GraphQL 👉 <a href="https://aws.amazon.com/compare/the-difference-between-graphql-and-rest/#:~:text=A%20REST%20API%20is%20an,focused%20on%20making%20new%20APIs."><strong>here</strong></a>.</li></ul><h4>4. The Beauty of APIs in a Multilingual System✨</h4><ul><li><em>“A website might use React for the UI, Node.js for publishing, and PHP for submission. APIs help these diverse technologies work together harmoniously.”</em></li><li><em>“It’s like an orchestra where every instrument plays its role perfectly, thanks to the conductor — the API.”</em></li></ul><h4>5. Hands-On: Building a Weather App Using a Weather API in Python</h4><ul><li>Let’s put theory into practice by building a weather app using Python. We’ll fetch real-time weather data from <strong>OpenWeatherMap’s API</strong> and display it in the console.</li><li>Step by Step Guide :</li></ul><blockquote>Prerequisite :</blockquote><ol><li>We need to install <a href="https://www.python.org/downloads/">python</a> (3.x or higher)</li><li>To handle the request we will be using <strong>HTTP</strong> protocol .</li></ol><p>pip install requests</p><p>3. Sign up at <a href="https://openweathermap.org/">OpenWeatherMap</a> and generate a free API key.</p><blockquote>Fethcing data from the Weather api :</blockquote><p>The API endpoint provided by OpenWeatherMap follows this format:<br>https://api.openweathermap.org/data/2.5/weather?q={city}&amp;appid={API_KEY}</p><ul><li>By replacing {city} with the desired city name and {API_KEY} with your OpenWeatherMap API key, you can retrieve the weather information for a specific location.</li><li>Using the Python code below, you can input the city name, utilize the API endpoint, and obtain the weather details for that city.</li></ul><pre>import requests<br><br># API details<br>API_KEY = &#39;YOUR_API_KEY&#39;<br>BASE_URL = &#39;https://api.openweathermap.org/data/2.5/weather&#39;<br><br>def get_weather(city):<br>    # Constructing the API URL<br>    url = f&quot;{BASE_URL}?q={city}&amp;appid={API_KEY}&amp;units=metric&quot;<br>    <br>    # Making API call<br>    response = requests.get(url)<br>    if response.status_code == 200:<br>        data = response.json()<br>        return data<br>    else:<br>        return None<br><br>def display_weather(data):<br>    # Extract the required information<br>    city_name = data[&#39;name&#39;]<br>    country = data[&#39;sys&#39;][&#39;country&#39;]<br>    temperature = data[&#39;main&#39;][&#39;temp&#39;]<br>    humidity = data[&#39;main&#39;][&#39;humidity&#39;]<br>    description = data[&#39;weather&#39;][0][&#39;description&#39;]<br>    <br>    # Print the weather details<br>    print(f&quot;\nWeather in {city_name}, {country}:&quot;)<br>    print(f&quot;Temperature: {temperature}°C&quot;)<br>    print(f&quot;Humidity: {humidity}%&quot;)<br>    print(f&quot;Condition: {description.capitalize()}&quot;)<br><br># Main program<br>if __name__ == &quot;__main__&quot;:<br>    city = input(&quot;Enter city name: &quot;)<br>    weather_data = get_weather(city)<br>    if weather_data:<br>        display_weather(weather_data)<br>    else:<br>        print(&quot;City not found. Enter something else.&quot;)</pre><ul><li>Pro Tip 😎: Since this is a free account, the number of API requests allowed per day is limited. To secure sensitive information like API keys, passwords, and email addresses, store them in Windows environment variables. You can later access these variables in Python using the os module.</li><li>Here you can know 😍👉 <a href="https://www.geeksforgeeks.org/access-environment-variable-values-in-python/">how to read environment variables in Python</a>.</li><li>Experiment with the API parameters to customize the data you retrieve, such as selecting the temperature unit (Celsius or Fahrenheit).”</li></ul><h4>6. Real-World API Applications</h4><ul><li>Google Maps API (for location services).</li><li>Twitter API (for fetching tweets).</li><li>Payment Gateway APIs (like Stripe or PayPal).</li></ul><blockquote>🎯 <strong>What’s Next ? — — — — — — — </strong>🚀</blockquote><ul><li><em>“Try building something with a public API today. It’s easier than you think and incredibly rewarding!”</em></li><li>Start exploring public APIs. The best way to learn is by doing — build fun projects like a weather app or a movie database.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31bbb8e3e58f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>