<?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 Shabeer Mohomad on Medium]]></title>
        <description><![CDATA[Stories by Shabeer Mohomad on Medium]]></description>
        <link>https://medium.com/@moshdev2213?source=rss-f26c4e70ab1d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1S2Tn62mtvMv2Mg2fBYBIQ.png</url>
            <title>Stories by Shabeer Mohomad on Medium</title>
            <link>https://medium.com/@moshdev2213?source=rss-f26c4e70ab1d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:48:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@moshdev2213/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[Building a Shift-Left QA Platform]]></title>
            <link>https://medium.com/@moshdev2213/building-a-shift-left-qa-platform-f8d2135625ea?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8d2135625ea</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cloud-infrastructure]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 11:49:07 GMT</pubDate>
            <atom:updated>2026-10-27T11:49:07.623Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Building a Shift-Left Platform That Gives Testers Their Time Back</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYD78o80nbpw4dcLDJqj-A.png" /></figure><p>Let’s skip the fluff and get straight to the real talk. Most teams don’t have a <em>testing problem</em>, they have a wiring problem. We hire smart QA engineers to find edge cases and protect the product, and then we trap them in a daily loop of manual admin work.</p><h4><strong>A QA engineer’s day, before</strong></h4><ul><li>10:00 — A dev pings: <em>”Can you run regression on staging? I just merged.”</em></li><li>10:20 — The PM asks: <em>”Are the checkout stories covered?” </em>You open a spreadsheet.</li><li>11:00 — Copy acceptance criteria from the ticket into the test tool. Again.</li><li>2:00 — Dig through a CI log to work out if a failure is a real bug or just a flaky env.</li><li>5:30 — You realise you haven’t actually <em>tested</em> anything new today.</li></ul><p>If you’ve worked in QA, you’ve lived this day. You’re not doing quality work. You’re the human glue between five tools and ten people.</p><p>And that slows everyone down, not just QA. Devs wait for feedback. PMs wait for coverage answers. Releases wait for <strong><em>the run</em></strong>. The QA engineer turns into a queue, and nobody chose that, it’s just how the tooling is set up.</p><p>Here’s what mostly causes it:</p><ul><li>Tests sit inside each app repo, so nobody has the full picture</li><li>Requirements get re-typed into the test tool by hand</li><li>Results live in a CI log that only QA knows how to read</li><li>Performance testing happens “before launch” (it doesn’t happen)</li></ul><p>So I asked myself a simple question:</p><blockquote>If I joined a project tomorrow with adequate QA setup, what would I build so QA can spend their time on actual quality, and the whole team ships faster?</blockquote><p><strong>Omni-Suites</strong> is my answer. This blog is the blueprint.</p><p><strong>First of all, is this for you? </strong>Come on, let&#39;s be honest with yourself for a second:</p><ul><li>Are you on a <strong>small to medium-sized project</strong>, maybe 3 to 30 people, where QA is one to five people (or “whoever has time”)?</li><li>Is your team <strong>shipping every week or two</strong>, but testing still feels like the step everyone waits on?</li><li>Do you <strong>want enterprise-style QA</strong> (traceability, reports, perf tests) without an enterprise budget or a platform team?</li><li>Are you a <strong>QA engineer, SDET, or dev </strong>who keeps saying “we should really set this up properly”?</li></ul><p>If you nodded at two or more of those, this blog is for you, we are in this together mate.</p><p>If you’re at a big company with a dedicated platform team and paid licences for everything, you’ll probably still pick up a few ideas, but you’re not who I built this for.</p><h4><strong>The rules I set before writing a single line</strong></h4><p>Before any tools, I wrote down some rules. Every decision after that had to respect them.</p><p><strong>1. Tests don’t live inside the app.<br></strong>Functional tests and performance tests each get their own repo. They test <em>environments</em>, not codebases. The same suite can hit <strong>preview </strong>or <strong>staging</strong> without touching application code.</p><p><strong>2. Every test points back to a requirement.<br></strong>If a test can’t tell you <em>why</em> it exists, it’s just noise.</p><p><strong>3. Running tests should be self-serve.<br></strong>A dev who wants a quick smoke check shouldn’t have to wait in QA’s queue. Make the routine stuff one command away for everyone, so QA’s time goes into designing better tests, exploring edge cases, and thinking about risk.</p><p><strong>4. One VM. Open-source only.<br></strong>No managed Kubernetes, no paid SaaS seats. If it can’t run on one cloud box, it’s too complicated for a small team to adopt.</p><p>Which of these rules does your team break right now? Be honest.</p><p>Quick note before we start building. I picked <strong>Linear</strong> for planning and <strong>Discord</strong> for ChatOps because they’re what I like using. That’s the only reason.</p><p>Your team probably uses something else, and that’s completely fine. The blueprint doesn’t care which tools you use. What matters is the <strong>flow,</strong> requirement → test case → automated test → result → back to the team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*76_sFfxTC1qZafQ-cSoA8w.png" /></figure><p>Most of these have webhooks and REST APIs, so the middleware idea stays exactly the same. You change the adapter, not the architecture. Jira has webhooks and labels just like Linear. Slack has slash commands just like Discord.</p><p>When you see <strong>Linear </strong>or <strong>Discord </strong>below, just read it as <em>your planning tool</em> and <em>your team chat</em></p><h4><strong>The blueprint, in build order</strong></h4><p>The order matters. A lot of teams start with “let’s pick a test framework.” I think that’s step 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3K21v-56nsj-uqCv4eBAQ.png" /><figcaption>A simple numbered build order graphic</figcaption></figure><h4><strong>Step 1: Build the shared ground first</strong></h4><p>Before anything gets tested, everything needs somewhere to live.</p><ul><li><strong>One GCP Compute Engine VM</strong> running Docker Compose</li><li><strong>Traefik </strong>in front of everything, handling HTTPS with automatic Let’s Encrypt certificates</li><li>Every service gets its own subdomain: <em>order-svc.…</em>, <em>squash-tcms.…</em>, <em>report-portal.…</em></li><li><strong>Databases are never exposed.</strong> Postgres, MySQL, Mongo, OpenSearch and RabbitMQ only sit on private Docker networks. The VM opens exactly three ports: 22, 80, and 443.</li></ul><p>💰 <strong>Budget note:</strong> A managed Kubernetes cluster plus a load balancer would cost several times more. One VM plus Traefik does the job for a team this size.</p><h4><strong>Step 2: Something real to test</strong></h4><p>A QA platform with nothing to test is just a slide deck. So I built a small but <em>annoying</em> system on purpose:</p><ul><li><strong>omni-client</strong>: a React storefront</li><li><strong>order-service</strong>: NestJS + PostgreSQL</li><li><strong>inventory-service</strong>: NestJS + MySQL</li><li><strong>notification-service</strong>: NestJS + MongoDB</li></ul><p>Three services, three different databases, one “Buy” button.</p><p>When you click Buy, the order service deducts stock from inventory, saves the order, then fires a notification. If the notification fails, the order still goes through. That kind of “partial failure is fine” logic is exactly what tests tend to miss.</p><h4><strong>Step 3: Requirements first (this is where shift-left happens)</strong></h4><p>Everyone says <em>shift-left.</em> Here’s what it means in practice: <strong>tests start existing before code does. </strong>The flow :-</p><ol><li>A PM writes a story in <strong>Linear</strong> with acceptance criteria in plain Given/When/Then</li><li>When the story is ready, they add one label: <strong><em>ready-for-tc</em></strong></li><li>A webhook hits NestJS middleware (omni-integration)</li><li>The middleware parses the story and creates a structured requirement in <strong>Squash TM</strong> automatically</li></ol><p>No copy-pasting between tools. QA gets a structured requirement the moment the story is ready, so they start test design <em>during</em> the sprint, not after dev hands over. That’s hours of re-typing gone every sprint, and QA is in the conversation from day one instead of being the last stop.</p><p>Remove the label, and the requirement in Squash gets marked <strong><em>Not ready</em></strong>.</p><p><strong>On Jira?</strong> Same idea. Use a Jira webhook on a label or status change (like Ready for QA), and point it at the same kind of middleware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*C-qCPIefgvX8fuTiiRgmDQ.png" /><figcaption>Linear sample requirment</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*6c38GphbV6tW0ATDGrZz5A.png" /><figcaption>SquashTM synced requirement</figcaption></figure><p>💰 <strong>Budget note:</strong> TestRail, Xray and Zephyr all charge per seat. Squash TM is open-source and self-hosted. The UI is less pretty, but it does the job.</p><h4><strong>Step 4: Functional tests as their own product</strong></h4><p>The <strong><em>test-suites</em></strong> repo is <strong>Playwright + TypeScript</strong>, covering both browser UI and REST APIs.</p><p>Decisions I’d make again:</p><ul><li><strong>Tags, not folders. </strong>Tests are grouped by domain (order, inventory, notification), and <em>what kind</em> of test it is comes from tags: <strong><em>@smoke</em></strong>, <strong><em>@regression</em></strong>, <strong><em>@ui</em></strong>, <strong><em>@api</em></strong>.</li></ul><p>Every test carries its requirement ID. Right in the title:</p><pre>test(&#39;Place valid order end-to-end @smoke @regression @ui [TC-101]&#39;, async ({ page }) =&gt; {<br>attachRpMeta({<br>testCaseId: &#39;TC-101&#39;,<br>suites: [&#39;smoke&#39;, &#39;regression&#39;],<br>layer: &#39;ui&#39;,<br>service: &#39;omni-client&#39;,<br>});<br>await openOmniClient(page);<br>// more codes…<br>});</pre><p>That <strong>[TC-101]</strong> is the thread that ties everything together. Linear story → Squash requirement → Playwright test → test result. One ID, end to end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*IDO7mE7FMbEkfIdBOtoZJA.png" /><figcaption>Playwright powered test result output</figcaption></figure><h4><strong>Step 5: Performance testing from day one, not launch week</strong></h4><p>Performance testing usually means “we’ll do it before go-live.” That week never comes.</p><p>So <strong>perf-suites</strong> is its own repo from the start: <strong>Grafana k6 + TypeScript</strong>, bundled with Webpack.</p><p>It has four profiles, in plain English:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sR-iHTyU_pSTkBGV3ogn8w.jpeg" /><figcaption>Types of performance profiles</figcaption></figure><p>And a hard quality gate: <strong>95% of requests under 500ms, and fewer than 1% errors. </strong>Miss that, and the run fails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*b2A0yKSFvXJTrIhod27yKQ.png" /><figcaption>GitHub action sample K6 output</figcaption></figure><p>💰 <strong>Budget note:</strong> k6 OSS running on GitHub Actions runners instead of k6 Cloud or LoadRunner. You lose distributed load generation, which is fine at this scale.</p><h4><strong>Step 6: Results people actually read</strong></h4><p>A test result nobody reads might as well not exist.</p><p>Every Playwright run streams into a self-hosted <strong>ReportPortal</strong>: logs, screenshots, test IDs, suite tags.</p><p>Results can also sync back into <strong>Squash TM</strong>, so the requirement from Step 3 now shows whether it’s actually passing.</p><p>That’s the loop closed: <strong>requirement → test → result → back to the requirement</strong></p><p>For QA, this is the big time saver. Instead of opening 40 failures one by one, you start from a list that’s already sorted, so you spend time on the real bugs, not on the 30 flaky env timeouts. When the PM asks “are the checkout stories covered?”, the answer is a link, not an afternoon with a spreadsheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cSlUY4psKijfxMD5Tnwp3A.png" /><figcaption>ReportPortal output dashbaord</figcaption></figure><p>💰 <strong>Budget note:</strong> Self-hosted ReportPortal is free. It’s also <strong>12 containers</strong>: Postgres, RabbitMQ, OpenSearch, API, UI, Jobs, Analyzer, and a few more. On one VM, that’s the heaviest thing on the box by far, but still, we can only run the core services according to their official documentation</p><h4><strong>Step 7 — Make it self-serve</strong></h4><p>This is the step that gives QA their day back.</p><p>I built a <strong>Discord bot </strong>into the same middleware. Anyone in the server can type:</p><pre>/run-tests environment:staging suite:smoke browser:chromium</pre><p>or</p><pre>/run-perf profile:load service:checkout vus:50</pre><p>The bot dispatches the right GitHub Actions workflow and posts live status into <strong><em>#test-releases</em></strong> Discord channel: started, running, passed or failed, with links to the reports.</p><p>A dev can check their merge didn’t break checkout without waiting for anyone. A DEV can run smoke tests on staging before a demo. QA isn’t pinged ten times a day to “just kick off a run.”</p><p>And the QA engineer? They’re still the one who decides <em>what</em> gets tested, writes the suites, reads the trends, and calls the release. They just stop being the person who manually presses Run all day.</p><p><strong>Less waiting for the team, more real testing from QA.</strong></p><p>🔁 <strong>On Slack or Teams?</strong> Both support slash commands and rich message cards. The bot logic (verify the request → dispatch the CI workflow → post status updates) doesn’t change, only the chat API you call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*cxLjGdi4zjI-3OnGvqoGlQ.png" /><figcaption>Discord release channels and BOT channel</figcaption></figure><h3><strong>The full picture</strong></h3><p>Now that we’ve built it piece by piece, here’s the whole thing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfmikTDfQ1UfiWiv4IYRfA.png" /></figure><p>Read it left to right and it’s the same story as this post: PMs, QA and devs work in the tools they already use on the left, the automation does the repetitive work in the middle, and evidence ends up on the right where the whole team can see it.</p><h3><strong>One sprint, start to finish: a walkthrough</strong></h3><p>Diagrams are nice, but let’s see what this looks like on a real week.</p><p>Here’s the setup:</p><ul><li><strong>Weekly sprint</strong>, starting <strong>Tuesday</strong>, ending the following <strong>Monday</strong></li><li>A small team: 1 PM/BA, 1 tech lead, 1 senior dev, 3 devs, 1 QA lead, 1 QA engineer</li><li>One feature going all the way from idea to production</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HnXsg8SWchsvV63t_WVxpQ.jpeg" /></figure><h4><strong>The Feature</strong></h4><ul><li><strong>OMNI-42: Low-stock warning and over-order protection</strong></li><li><em>“As a customer, I want to see when an item is almost sold out, and I shouldn’t be able to order more than what’s actually in stock.”</em></li></ul><p>It touches three services: the storefront (show the badge), inventory (block the over-order), and notifications (alert when stock runs low). A small feature, but it crosses the whole system, which makes it a good test of the platform.</p><p><strong>Monday (before the sprint): grooming<br>Who’s in the room:</strong> PM/BA, tech lead, a senior dev, and the QA lead. The PM brings the rough story. Together they turn it into acceptance criteria everyone can read (BDD/Gherkin format would be good):</p><pre>Scenario: Low-stock badge<br>Given an item has 5 or fewer units in stock<br>When the customer opens the storefront<br>Then they see &quot;Only X left&quot; on that item</pre><pre>Scenario: Block over-ordering<br>Given an item has 3 units in stock<br>When the customer tries to order 5<br>Then the order is rejected with a clear message<br>And the stock stays at 3</pre><pre>Scenario: Low-stock alert<br>Given an item&#39;s stock drops to the threshold<br>Then a low-stock notification is created</pre><p>This is where the QA lead earns their place in the room. They ask the awkward questions <em>before</em> any code exists:</p><ul><li><em>“What if two people buy the last item at the same moment?”</em></li><li><em>“Does the badge update after an order, or only after a refresh?”</em></li><li><em>“What happens if the notification service is down? Does the order still go through?”</em></li></ul><p>Some of these become extra scenarios. Some become notes for exploratory testing later.</p><p>When everyone agrees the story is ready, the PM adds one label: <strong><em>ready-for-tc</em></strong><em>.</em></p><p>A few seconds later, the requirement shows up in Squash TM. Nobody copied it over. The QA lead breaks it into test cases right there:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JKtZNB63G8glbrVv0Gpnow.jpeg" /><figcaption>finalized test cases by the QA</figcaption></figure><h4><strong>Tuesday (Day 1): sprint planning</strong></h4><p>The story is pulled into the sprint, and <strong>everyone gets their part of it at the same time.</strong> That’s the shift-left bit. QA doesn’t wait for dev to finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ZijDw1UeEKzSNKeXmgBAA.jpeg" /><figcaption>tasks assigned to each member of the team according to the spring planning</figcaption></figure><p>Notice Dev C owns the perf script. Perf testing isn’t “QA’s job at the end.” The person adding a new check on the hot checkout path is the best person to write the load test for it, and the QA lead reviews it.</p><p>By Tuesday afternoon, the QA engineer has already started writing specs against the agreed API contract. The endpoint doesn’t exist yet, so the tests are marked `fixme` for now:</p><pre>test.fixme(&#39;Over-order is rejected and stock is unchanged @regression @api [TC-121]&#39;, async ({ request }) =&gt; {<br>// written from the acceptance criteria on Day 1,<br>// switched on as soon as the endpoint lands on dev<br>});</pre><h4><strong>Wednesday (Day 2): first code lands on dev</strong></h4><p>Dev B pushes the inventory validation, and it deploys to the preview environment.</p><p>The QA engineer flips TC-121 from <strong><em>fixme </em></strong>to a real test and opens a PR on <strong>test-suites.</strong></p><p>Meanwhile, Dev B doesn’t wait for anyone. They type this in Discord:</p><pre>/run-tests environment:dev suite:inventory</pre><p>Two minutes later, the embed in <strong>#test-releases</strong> goes red. ReportPortal tags the failure as a <strong>product bug</strong>: ordering 5 when 3 are left returns <strong>500 </strong>instead of a clean <strong>400</strong>.</p><p>Dev B fixes it before lunch, re-runs the command, and it goes green.</p><p><strong>QA wasn’t pinged once.</strong> The QA engineer saw it in the channel, nodded, and kept writing TC-120.</p><h4><strong>Thursday (Day 3): UI and perf come together</strong></h4><ul><li>Dev A ships the low-stock badge to preview.</li><li>The QA engineer commits <strong>TC-120</strong> to<strong> test-suites</strong>.</li><li>Dev C commits the low-stock alert and adds a k6 module to <strong>perf-suites</strong> that hammers <strong>/inventory/deduct</strong> with the new validation in place.</li></ul><p>Dev C checks the perf impact right away:</p><pre>/run-perf profile:smoke service:inventory</pre><p>p95 stays well under the threshold. The new validation didn’t slow down checkout. Good to know on Thursday, not the night before release.</p><p>The QA lead commits <strong>TC-122</strong> and <strong>TC-123</strong>. All four test cases for OMNI-42 now exist as real automated tests, each one linked back to the Linear story by its [TC-xxx] ID.</p><h4><strong>Friday (Day 4): merge to staging, QA explores</strong></h4><p>The feature branches get merged and pushed to <strong>staging</strong>. CI builds the images, pushes them to the registry, and the VM picks them up.</p><p>A <strong>smoke run fires automatically</strong> on merge. Green.</p><p>Now here’s the part I care about most: <strong>the QA lead and QA engineer spend Friday doing exploratory testing.</strong> Not running suites, not re-typing test cases, not chasing logs. Actual testing.</p><p>Remember the awkward question from grooming? “<em>What if two people buy the last item at once?”</em> That’s what they go after. Two browser windows, same item, one unit left, click Buy at the same time.</p><ul><li><em>(a)</em> It holds up because the inventory update is atomic, and QA adds it as <strong>TC-124</strong> so it stays covered, <strong>or</strong></li><li><em>(b) </em>They find a real race condition, log it in Linear as a bug linked to OMNI-42, and Dev B fixes it Monday morning.</li></ul><p><em>(Option b makes a better story, honestly. Bugs found on Friday by a human beat bugs found by customers on Wednesday.)</em></p><h4><strong>The weekend: the machines keep watch</strong></h4><p>Nobody works on the weekend. The platform does.</p><ul><li><strong>Nightly regression</strong> runs the full Playwright suite on staging</li><li><strong>Nightly perf</strong> runs the k6 load profile on staging</li><li>Results stream into ReportPortal and sync back to Squash TM</li><li>Summaries land in <strong>#test-releases</strong></li></ul><p>By Monday morning, there’s a full history waiting, not a fresh mystery.</p><h4><strong>Monday (Day 6): go / no-go</strong></h4><p>The QA lead opens Squash TM and checks the OMNI-42 requirement. Every linked test case (TC-120 to TC-123, plus TC-124 if you added it) has a passing result from the nightly runs.</p><p>One last check before release in the staging, on the flow most likely to hurt:</p><pre>/run-perf profile:load service:checkout</pre><p>Green, within SLA.</p><p>The PM doesn’t need to ask “<em>are we good?”</em>. They can open the same Squash requirement and see it themselves.</p><p>The QA lead gives the go. <strong>The release decision is still a human call, made by the team.</strong> It’s just made with evidence instead of gut feel.</p><h4><strong>Tuesday: release to prod, and the next sprint starts</strong></h4><p>OMNI-42 goes to production through the team’s normal release process.</p><p>And the same morning, the next sprint’s planning starts, with new stories already labelled <strong>ready-for-tc</strong> from Monday’s grooming.</p><h4><strong>Looking back at the week</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZZbYWuvW_gxVkIo33Es0uw.jpeg" /></figure><p>What <strong><em>didn’t</em></strong> happen this week:</p><ul><li>Nobody re-typed acceptance criteria into a test tool</li><li>Nobody waited in a queue for QA to “just run the tests”</li><li>Nobody asked “are we covered?” and got a spreadsheet back</li><li>Perf wasn’t left for the night before release</li><li>QA spent a whole day on exploratory testing, the stuff only humans are good at</li></ul><p>That’s the productivity boost. Not for QA alone, for the whole team.</p><p>Compare this to your last sprint. Which day hurt the most? That’s probably where to start.</p><h3>Final Thoughts</h3><p>You don’t need all seven steps on day one. If you’re small, Here’s the version I’d start with:</p><ul><li>Separate test repo with Playwright</li><li>Env-driven config, no hardcoded URLs</li><li>[TC-xxx] IDs in test titles, even if they just point at a spreadsheet</li><li>One GitHub Actions workflow that anyone can trigger manually</li></ul><p><strong>Add next:</strong> k6 smoke + load profiles, ReportPortal</p><p><strong>Add when it hurts:</strong> Squash TM sync, planning-tool webhooks (Linear / Jira), the chatbot (Discord / Slack)</p><p>The rules matter more than the tools. You can swap every tool in this post and the blueprint still works.</p><h4><strong>A QA engineer’s day, after</strong></h4><ul><li>10:00 — The dev already ran <strong>/run-tests</strong> after merging. Green. No ping.</li><li>10:20 — The PM checks Squash TM and sees checkout coverage for themselves.</li><li>11:00 — New Linear stories have already shown up as requirements. You start designing tests.</li><li>2:00 — ReportPortal has already grouped the failures. You look at the 3 real ones.</li><li>3:00 — You spend the afternoon on exploratory testing on the new feature. Actual QA work.</li></ul><p>The tools didn’t replace anyone. They took the busywork off QA’s plate, and that made the whole team faster, devs get feedback in minutes, PMs get answers without asking, and releases stop waiting on a manual run.</p><p><strong>So, on your team: how much of QA’s day goes to running things vs. actually testing?</strong> Tell me in the comments. I’m curious what that ratio looks like for you.</p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>GitHub</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8d2135625ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Java Works: JVM, JDK, and JRE for Beginners]]></title>
            <link>https://medium.com/@moshdev2213/how-java-works-jvm-jdk-and-jre-for-beginners-8b4e9f1d87cf?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b4e9f1d87cf</guid>
            <category><![CDATA[theory]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Tue, 20 Jan 2026 04:53:58 GMT</pubDate>
            <atom:updated>2026-01-20T04:53:58.551Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A simple guide to understanding the building blocks of Java and how they work together to run your code.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TV7JnhBUYR99OpaJYX0ZFw.png" /></figure><p>Let’s say you’re just stepping into the world of programming, and someone says, <em>“Hey, Java is a great place to start!”</em> You open your IDE, write a simple <strong>HelloWorld </strong>program, and it magically prints text to the screen. You’re hooked.</p><p>But then, questions hit you:</p><ul><li>What happens <em>under the hood</em> when you run a Java program?</li><li>What exactly are <strong>JVM</strong>, <strong>JDK</strong>, and <strong>JRE</strong>?</li><li>Do I need all three? Are they different tools?</li></ul><p>In this blog, we’ll uncover the magic behind<strong> Java,</strong> starting from writing code to watching it come alive. We’ll break down the roles of <strong>JDK</strong>, <strong>JRE</strong>, and <strong>JVM</strong>, and explain how they all work together in the Java ecosystem.</p><h3>☕ A Simple Java Journey</h3><p>Imagine you write the following code:</p><pre>public class HelloWorld {<br>    public static void main(String[] args) {<br>        System.out.println(&quot;Hello, World!&quot;);<br>    }<br>}</pre><p>You hit <strong>Run</strong>, and boom, you see <strong>“Hello, World!”</strong> printed on the screen. But what just happened? 🤔To make sense of it, let’s introduce the 3 key players: <strong>JDK</strong>, <strong>JRE</strong>, and <strong>JVM</strong>.</p><figure><img alt="Image showing the main components" src="https://cdn-images-1.medium.com/max/1024/1*uTFdJjq3aPTXSF3uRowctQ.png" /><figcaption>Image showing the main components and how they are interconnected (credits <a href="https://medium.com/u/87184e947826">Heeah</a>)</figcaption></figure><h3>JDK (Java Development Kit): The Toolbox</h3><p>The <strong>JDK</strong> is what every Java developer installs on their machine. Think of it as a <strong>full development kit</strong> for building Java applications. It includes:</p><ul><li>A compiler (<strong><em>javac</em></strong>) to convert <em>.java</em> files into <em>.class</em> files.</li><li>Tools like <strong><em>javadoc</em></strong>, <strong><em>javap</em></strong>, and debuggers.</li><li>The <strong>JRE</strong> (yes, the JRE is part of the JDK).</li><li>Development libraries and tools needed to build and run Java applications.</li></ul><p>In simple terms:</p><p><strong><em>JDK = JRE + (Compiler + Development Tools)</em></strong></p><p>If you’re a developer, you <em>need</em> the JDK to <strong>write and compile</strong> your Java code.</p><h3>JRE (Java Runtime Environment): The Actor on Stage</h3><p>The <strong>JRE</strong> is the environment that <strong>runs</strong> Java programs. It doesn’t include the compiler or other development tools. It’s only focused on <strong>execution</strong>. It contains:</p><ul><li>The <strong>JVM</strong></li><li>Core Java class libraries (like java.lang, java.util)</li><li>Supporting files to execute programs</li></ul><p>You can think of the JRE as the <strong>theater stage</strong> where the drama (your code) plays out. Who uses JRE?</p><ul><li>End users who just need to <strong>run</strong> Java applications</li><li>Web browsers and servers that rely on Java-based plugins (legacy use cases)</li></ul><p><em>If you’re </em><strong><em>only running </em></strong><em>Java programs, the JRE is all you need.</em></p><h3>JVM (Java Virtual Machine): The Brain</h3><p>Now we get to the real MVP: the <strong>Java Virtual Machine</strong>.</p><p>The <strong>JVM</strong> is what actually executes the compiled Java code (the .class files). It sits inside the JRE and provides a platform-independent way to run Java programs.</p><h4>How it works:</h4><ol><li>You write Java code.</li><li>The <strong>compiler</strong> (<em>javac</em>) turns your <em>.java</em> file into a <em>.class</em> file (which contains bytecode).</li><li>The <strong>JVM</strong> loads the bytecode and converts it into <strong>machine code</strong> (specific to your OS and CPU) using Just-In-Time (JIT) compilation.</li><li>Your application runs.</li></ol><p><strong><em>JVM = Write Once, Run Anywhere (WORA)</em></strong></p><p>The JVM is what gives Java its famous feature, <strong>platform independence</strong>. Your bytecode doesn’t care whether you’re on Windows, Linux, or macOS the JVM takes care of translating it. Let’s also have a look in some of hte main components that reside in the JVM.</p><ul><li><strong>Class Loader</strong>: Loads <em>.class</em> files dynamically.</li><li><strong>Bytecode Verifier</strong>: Checks code for security and correctness.</li><li><strong>Execution Engine</strong>: Runs the code. Includes interpreter and <strong><em>JIT </em></strong>compiler.</li><li><strong>Garbage Collector</strong>: Manages memory by removing unused objects automatically.</li></ul><h3>The Big Picture: From Code to Execution</h3><p>Let’s tie it all together with a step-by-step flow:</p><ol><li>You write HelloWorld.java.</li><li>The JDK’s javac compiler converts it to HelloWorld.class (bytecode).</li><li>The JRE loads this bytecode.</li><li>The JVM interprets or JIT compiles the bytecode into machine code.</li><li>The output is shown on your screen.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*zcCPQPDuaONKt8zLwHO2kQ.png" /><figcaption>step-by-step way of code to execution</figcaption></figure><h3>Some Interesting QnA’s</h3><p><strong>Q: Do I need all three, JDK, JRE, and JVM, to code in Java?</strong><br> A: If you’re a developer, install the <strong>JDK</strong>. It includes both the <strong>JRE</strong> and <strong>JVM</strong>, so you’re good to go!</p><p><strong>Q: Can I run Java without JDK?</strong><br> A: Yes, if you’re only executing <em>.class</em> files and not writing code. The <strong>JRE</strong> is enough for that.</p><p><strong>Q: Is JVM specific to Java only?</strong><br> A: While it was designed for Java, some languages like <strong>Kotlin</strong>, <strong>Scala</strong>, and <strong>Groovy</strong> also run on the JVM.</p><h3>Wrapping Up</h3><p>The world of Java may seem complex at first, but once we understand the roles of <strong>JDK</strong>, <strong>JRE</strong>, and <strong>JVM</strong>, everything starts to link.</p><ul><li><strong>JDK</strong> helps you write and compile code.</li><li><strong>JRE</strong> helps you run that code.</li><li><strong>JVM</strong> ensures it runs everywhere.</li></ul><p>This trio is what powers millions of Java applications around the globe, from Android apps to complex financial domains.</p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b4e9f1d87cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka Retry Strategies & Dead Letter Topics: A Theoretical Guide]]></title>
            <link>https://medium.com/@moshdev2213/kafka-retry-strategies-dead-letter-topics-a-theoretical-guide-cae6d459665c?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cae6d459665c</guid>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 10:08:06 GMT</pubDate>
            <atom:updated>2025-12-21T10:08:06.099Z</atom:updated>
            <content:encoded><![CDATA[<p>A theoretical overview of fault handling in Kafka, from retries to dead letter topics</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YtyZZHsQVj0-5eppFatUMw.png" /></figure><h3>Introduction: What Happens When Things Go Wrong?</h3><p>You’ve built a solid Kafka-based microservice architecture. Events are flying across topics, consumers are processing them smoothly, and all seems well… until one consumer throws an <em>exception</em>.</p><p>Now what?</p><ul><li>Do you keep <em>retrying </em>the same message forever?</li><li>Do you lose the message?</li><li>Or… is there a smarter way to <strong>gracefully handle failures</strong>?</li></ul><p>Welcome to the world of <strong>Retry Queues</strong> and <strong>Dead Letter Topics (DLTs)</strong> in Apache Kafka, critical tools in designing <strong>resilient event pipelines</strong>.</p><h3>Real-World Scenario</h3><p>Okay, let&#39;s dive into a real-world scenario and understand the concepts clearly. Assume you have an <strong><em>order-service</em></strong> consuming events from a topic <strong><em>orders</em></strong>. One day, it receives a payload like this:</p><pre>{<br>  &quot;orderId&quot;: &quot;123&quot;,<br>  &quot;amount&quot;: &quot;abc&quot;, <br>  &quot;currency&quot;: &quot;USD&quot;<br>}</pre><p>Oops! <strong><em>“amount”: “abc”</em></strong> is invalid. Your consumer throws a deserialization or validation error. You now face <strong>two risks</strong>:</p><ol><li><strong>Message loss</strong> occurs if not handled properly.</li><li><strong>Infinite reprocessing loop</strong> if you keep retrying broken data.</li></ol><p>That’s where <strong>Retry Topics</strong> and <strong>Dead Letter Topics</strong> shine. Will go through each of them, and let&#39;s get a clear understanding.</p><h3>Retry Queues: Let’s Try Again… Carefully</h3><h4>What is a Retry Queue?</h4><p>In technical terms, A <strong>retry queue</strong> (or retry topic) is an intermediate Kafka topic where failed messages are <strong>temporarily parked</strong> and then <strong>re-consumed after a delay</strong>, giving the downstream service a chance to recover.</p><h4>Why use Retry Queues?</h4><ul><li>Handle network issues or temporary DB downtimes</li><li>Avoid torturing the consumer with instant retries</li><li>Implement exponential <strong><em>backoff</em></strong><em> </em>retries</li></ul><h4>Basic Flow:</h4><ol><li>Consumer fails to process a message.</li><li>Instead of retrying immediately, the message is sent to a <strong><em>topic-retry-5s</em></strong>.</li><li>After 5 seconds, a separate consumer reads from <strong><em>topic-retry-5s</em></strong> and re-attempts processing.</li></ol><p>This gives each message multiple retry chances before giving up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*1hOZazUa51XryDwPZSonVg.png" /><figcaption>Shows how retrying is taken place with DLT</figcaption></figure><h3>Dead Letter Topics (DLTs): Final Resting Place</h3><p>Some failures are <strong>not fixable by waiting, </strong>e.g., corrupted payloads, invalid data, or unexpected schemas.</p><p>A <strong>Dead Letter Topic</strong> is a special Kafka topic where such <strong>irrecoverable messages</strong> are sent after all retry attempts fail.</p><h4>Benefits of DLTs:</h4><ul><li>Prevent infinite retry loops</li><li>Let developers inspect and manually reprocess or fix bad events</li><li>Improve system <strong>observability</strong> by centralizing failures</li></ul><h3>Implementing Retry &amp; DLT</h3><p>For this, we can handle retry logic manually, or we can also use frameworks, like:</p><ul><li>Spring Kafka</li><li>Kafka Streams</li><li>Kafka Connect + Error Handling</li></ul><p>Will make our hands dirty on an implementation walkthrough in another blog, all alone, without mixing it up here.</p><h3>When to Use Retry + DLT</h3><p>Use them when:</p><ul><li>Your system needs <strong>resilience against failure</strong></li><li>You deal with <strong>inter-service communication</strong></li><li>You care about <strong>not losing data</strong></li></ul><p>Avoid them when:</p><ul><li>You’re dealing with real-time/low-latency flows that can’t afford delays</li><li>The use case is simple enough that exception handling can happen in-line</li></ul><h3>Final Thoughts</h3><p>Retries and Dead Letter Topics play a major role in the world of Kafka. Without them, a single failure can bring the whole system down or flood the logs with exceptions.</p><p>By adding intelligent <strong>retry strategies</strong> and isolating bad events to DLTs, you give your architecture the <strong>resilience and observability</strong> it needs in production.</p><p>So the next time something breaks your system, it won’t scream. It’ll handle it like a pro. 💪😎</p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cae6d459665c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitOps in Action: Deploy Your First App with Argo CD]]></title>
            <link>https://medium.com/@moshdev2213/gitops-in-action-deploy-your-first-app-with-argo-cd-f77db8904fb3?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f77db8904fb3</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[argo-cd]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[gitops]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Tue, 16 Sep 2025 13:03:09 GMT</pubDate>
            <atom:updated>2025-09-16T13:03:09.603Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A foundational look at Argo CD for managing Kubernetes deployments using Git as the source of truth</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5dY8ygQawk5MdOUVW9WP7w.png" /><figcaption>Blog banner image</figcaption></figure><h3>Intro</h3><p>In our <strong>previous blogs</strong>, we explored and learned <strong>what Argo CD is</strong> and how it fits into the <strong>GitOps </strong>army. Now, it’s time to move from <strong>theory to practice</strong> and actually get Argo CD running in our Kubernetes cluster.</p><p>By the end of this guide, you’ll be able to:</p><ul><li>Install Argo CD</li><li>Access its dashboard</li><li>Deploy your first app using <strong>CLI and GUI</strong></li><li>See how <strong>GitOps </strong>works in real time</li></ul><h3>Prerequisites</h3><p>Before we begin, make sure you have:</p><ul><li><strong>Kubernetes cluster</strong> → Minikube, Kind, or any real cluster</li><li><strong>kubectl</strong> → CLI tool to talk to your Kubernetes cluster</li></ul><blockquote><em>💡 </em><strong><em>Tip:</em></strong><em> If you’re brand new, I recommend starting with </em><strong><em>Minikube(KIND is also a good start)</em></strong><em> because it’s easy to run locally.</em></blockquote><p>Verify everything is working:</p><pre>kubectl version --client<br>minikube version  # if using Minikube</pre><h3>Practical Demonstration</h3><p>Okay, now let&#39;s start, so I would say there are going to be 7 to 8 steps:</p><ol><li>Starting Kubernetes</li><li>Installing Argo CD</li><li>Accessing the Argo CD Dashboard</li><li>Log In to Argo CD</li><li>Deploy the App via CLI</li><li>Deploy the App via the Argo CD GUI</li><li>Testing the demo</li></ol><p>5 and 6 do the same thing, but using different approaches, choose your preferred way.</p><h4>Step 1: Start Kubernetes</h4><p>If you’re on Minikube, spin up your cluster</p><pre>minikube start<br>minikube status</pre><p>This launches a <strong>single-node Kubernetes cluster</strong> locally.<br> Think of it as your “mini cloud” running on your laptop, perfect for experimenting without breaking anything in production.</p><h4>Step 2: Install Argo CD</h4><p>First, create a dedicated namespace for Argo CD:</p><pre>kubectl create namespace argocd</pre><p>Then install Argo CD by applying its official YAML manifest:</p><pre>kubectl apply -n argocd \<br>  -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml</pre><p>Watch the pods start:</p><pre>kubectl get pods -n argocd -w</pre><p><strong>Why does this matter?</strong><br> Argo CD runs as multiple components in Kubernetes an API server, UI server, repo server, etc.(<em>learn more</em>). Installing it this way means you get <strong>the full GitOps engine</strong> up and running in minutes.</p><h4>Step 3: Access the Argo CD Dashboard</h4><p>Argo CD ships with a beautiful <strong>web UI</strong> that makes it beginner-friendly. We could forward its service to our local machine, this can be done in below shown ways(if using minikube, try the second set of commands),</p><pre>kubectl port-forward svc/argocd-server -n argocd 8080:443</pre><p>below shows a minikube way of exposing the Argo CD service</p><pre>minikube service argocd-server -n argocd</pre><p>Minikube will:</p><ul><li>Detect that <strong><em>argocd-server</em></strong> is a <strong>ClusterIP</strong> service (default for ArgoCD).</li><li>Temporarily create a <strong>tunnel</strong> or <strong>proxy</strong> so you can access it in your browser.</li><li>Automatically open your default browser to the ArgoCD UI.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQl2wZT2BJRDDRcjFBMrTA.png" /><figcaption>shows a minikube service used via cli</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ViGvcykbFn_auD15QxI3A.png" /><figcaption>shows the Argo CD web UI</figcaption></figure><h4>Step 4: Log In to Argo CD</h4><p>Get the initial admin password, it will be base64 encoded. The below will decode it and give the correct password</p><pre>kubectl -n argocd get secret argocd-initial-admin-secret \<br>  -o jsonpath=&quot;{.data.password}&quot; | base64 -d</pre><p>Log in with:</p><ul><li><strong>Username:</strong> admin</li><li><strong>Password:</strong> (value from above command)</li></ul><h4>Step 5: Deploy an App via CLI</h4><p>Let’s deploy Argo CD’s <strong>guestbook</strong> example app provided by Argo CD itself for learning purposes.</p><p>let&#39;s login, create the app, sync and check the status;</p><pre>#====== login to argo with CLI ========<br>argocd login localhost:8080 --username admin --password &lt;your-password&gt; --insecure<br><br>#====== Create the app =========<br>argocd app create guestbook \<br>  --repo https://github.com/argoproj/argocd-example-apps.git \<br>  --path guestbook \<br>  --dest-server https://kubernetes.default.svc \<br>  --dest-namespace default<br><br>#====== Sync the app =========<br>argocd app sync guestbook<br><br>#====== Check the app status =========<br>kubectl get pods</pre><h4>Step 6: Deploy an App via the Argo CD GUI</h4><p>If you prefer the UI, follow the below set of steps</p><ol><li>Log in to the <strong>Argo CD dashboard</strong>.</li><li>Click <strong>+ NEW APP</strong>.</li><li>Fill in:</li></ol><ul><li><strong>Application Name:</strong> hello-argocd</li><li><strong>Project:</strong> default</li><li><strong>Repository URL:</strong> use your GitOps repo(eg,- <a href="https://github.com/moshclouds/Managing-Kubernetes-Deployments-with-ArgoCD"><em>https://github.com/moshclouds/Managing-Kubernetes-Deployments-with-ArgoCD</em></a>)</li><li><strong>Path:</strong> guestbook</li><li><strong>Cluster:</strong> https://kubernentes.default.svc</li><li><strong>Namespace:</strong> default</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SOcQmfhZXqoazIjx9v-KSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KNlC2sStoUasyRcxSQwsrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_JSGSQ7mEBrB2cxF1rCMiQ.png" /></figure><p>4. Click <strong>Create</strong>.</p><p>5. Click <strong>Sync</strong> to deploy.</p><h4>Step 7: Test GitOps in Action</h4><p>Here’s where Argo CD shines:</p><ol><li>Edit the deployment in your Git repo.</li><li>Commit &amp; push changes.</li><li>Argo CD detects the change and syncs automatically (if auto-sync is enabled).</li><li>If you make a manual change in Kubernetes (<em>kubectl edit</em>), Argo CD marks it <strong><em>Out of Sync</em></strong> and can revert it.</li></ol><p>below set of images shows the final output of the project we did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWOdZ3TPGfmaSY_N_HQ1hg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qicduBKnIhiyiqxubLR2Jg.png" /></figure><h3>Wrapping Up</h3><p>By now, you’ve installed Argo CD, logged in using both the CLI and the web UI, and deployed your first application using GitOps principles. You’ve also seen how Argo CD keeps your application in sync with Git and even self-heals when things drift from the desired state.</p><p>I’ll attach a GitHub repo where all the above steps are implemented. Feel free to check it out if you’re interested, and dropping a star would be greatly appreciated!<br><a href="https://github.com/moshclouds/Managing-Kubernetes-Deployments-with-ArgoCD"><strong><em>https://github.com/moshclouds/Managing-Kubernetes-Deployments-with-ArgoCD</em></strong></a></p><p>From here, you can dive deeper into more advanced features like <strong>Argo Rollouts</strong> for canary and blue-green deployments, setting up <strong>multi-cluster deployments</strong>, and implementing <strong>RBAC</strong> for secure access control.</p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f77db8904fb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Multi-Stage Builds: Build Smart, Ship Fast]]></title>
            <link>https://medium.com/@moshdev2213/docker-multi-stage-builds-build-smart-ship-fast-7ed3db5daedc?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ed3db5daedc</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[multi-stage-builds]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 06:31:18 GMT</pubDate>
            <atom:updated>2025-09-05T06:31:18.153Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why ship everything when you only need what runs? Let&#39;s separate build-time tools from runtime essentials</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BML0rU7u0BHKqjhw1qVyKg.png" /><figcaption>Banner image showcasing multi-stages</figcaption></figure><p>In modern development, containers have become standard for deploying applications. But as projects grow, Docker images tend to get bulky, slowing down deployments, wasting storage, and increasing attack surfaces. Fortunately, Docker’s <strong>multi-stage builds</strong> offer a clean, efficient way to keep images small and production-ready without sacrificing the flexibility of development and build tooling.</p><p>In this blog, let&#39;s go through a practical example and explore why this approach should be part of your Docker toolbox.</p><h3>The Problem with Single-Stage Builds</h3><p>Imagine you’re building a Java application. You start with a Maven base image, compile the code, and ship the same image to production. Sounds simple, right? But here’s the issue:</p><ul><li>The final image includes your <strong>entire build toolchain, </strong>Maven, source code, and intermediate artifacts.</li><li>You expose your production container to unnecessary tools and files.</li><li>The image size can balloon, affecting startup time, transfer speed, and security.</li></ul><p>This is where multi-stage builds shine.</p><h3>What Are Multi-Stage Builds?</h3><p><strong>Multi-stage builds</strong> allow you to use multiple <strong><em>FROM</em></strong> statements in a Dockerfile. Each stage creates a temporary image where you can perform specific actions like compiling code or running tests. Then, in the final stage, you <strong>copy only what’s needed</strong> from earlier stages.</p><p>This gives both:</p><ul><li>Tools for building and testing</li><li>A lean, secure, and minimal final image</li></ul><h3>Multi-Stage Build in Action</h3><p>Let’s take a real-world example: recently, I was dockerizing a Maven-based Java application, and we will have a look based on that. The Dockerfile is as follows</p><pre># ----------- STAGE 1: Build the application -----------<br>FROM maven:3.9.6-eclipse-temurin-21 as build<br><br>WORKDIR /app<br><br># Copy pom and resolve dependencies<br>COPY pom.xml .<br>RUN mvn dependency:go-offline<br><br># Copy the full source and build the application<br>COPY src ./src<br>RUN mvn clean package -DskipTests<br><br><br># ----------- STAGE 2: Run the application -----------<br>FROM eclipse-temurin:21-jdk-alpine<br><br>WORKDIR /app<br><br># Copy only the built JAR from the build stage<br>COPY --from=build /app/target/*.jar app.jar<br><br>EXPOSE 8890<br>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><h4>Stage 1: Building the Application</h4><p>This image has Maven pre-installed. It’s used <strong>only for compiling</strong> your application.</p><p>We copy the <strong><em>pom.xml</em></strong> to pre-download dependencies. This step leverages Docker layer caching, meaning future builds will be faster if dependencies haven’t changed.</p><p>And then we copy the source and compile it. Tests are skipped here, but they can be enabled as needed</p><pre># Using maven as base image for the build<br>FROM maven:3.9.6-eclipse-temurin-21 as build<br><br># Copy pom and resolve dependencies<br>COPY pom.xml .<br>RUN mvn dependency:go-offline<br><br># Copy the full source and build the application<br>COPY src ./src<br>RUN mvn clean package -DskipTests</pre><h4>Stage 2: Running the Application</h4><p>In here, a <strong>slim and optimized Image </strong>is used for running the Java applications in production.<br>The magic happens when we copy only the <strong><em>.jar</em></strong> from the previous build stage, and thus <strong>no Maven, no source code, no bloat</strong>.<br>Finally, we expose the required port and run the app. <em>#Clean and minimal</em>, isn&#39;t it?😉</p><pre># Slim image for running the application<br>FROM eclipse-temurin:21-jdk-alpine<br><br># setting up the working directory<br>WORKDIR /app<br><br># Copy only the built JAR from the build stage<br>COPY --from=build /app/target/*.jar app.jar<br><br># Expose and run the application<br>EXPOSE 8890<br>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><h3>Benefits of Multi-Stage Builds</h3><p>Now, let&#39;s look at some of the benefits that we can achieve from these types of builds.</p><ul><li><strong>Smaller Image Sizes</strong>: We only ship what’s necessary, no dev tools, no temp files.</li><li><strong>Faster Deployments:</strong> Smaller images mean quicker pushes and pulls from registries.</li><li><strong>Better Security:</strong> With fewer tools inside the container, the attack surface is reduced.</li><li><strong>Layer Caching:</strong> Intelligent copying (like adding <em>pom.xml</em> before source code) helps Docker cache builds efficiently.</li><li><strong>Cleaner CI/CD Pipelines:</strong> We can use the same Dockerfile for both building and deploying, simplifying automation workflows.</li></ul><p>Below is a table where I have added some use cases and clarifications on why to use multi-stage builds, along with example scenarios and the associated benefits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*8SKBY3JFiL8SL716gznGiA.png" /><figcaption>Table showing some scenarios and benifits with them</figcaption></figure><h3>Final Thoughts</h3><p>Multi-stage builds help you <strong>build once, deploy cleanly</strong>. They improve security and align perfectly with modern DevOps practices.</p><p>By adopting this pattern, our Docker images become easier to manage, safer to run, and quicker to ship without losing the flexibility of the full development environment.</p><p>If you haven’t tried multi-stage builds yet, now’s the time. Start small, and you’ll never go back to bloated containers again.</p><p>I have also included a sample GitHub repo where you can have a hands-on experience. <br>Check it out here: <a href="https://github.com/moshclouds/Docker-multi-stage-builds"><strong><em>Docker-multi-stage-builds</em></strong></a></p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ed3db5daedc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Bricks to Houses: Demystifying POJO, Java Bean, and Spring Bean]]></title>
            <link>https://medium.com/@moshdev2213/from-bricks-to-houses-demystifying-pojo-java-bean-and-spring-bean-e49ac263566a?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e49ac263566a</guid>
            <category><![CDATA[pojo]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[inversion-of-control]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 06:05:04 GMT</pubDate>
            <atom:updated>2025-09-05T06:05:27.738Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Unraveling their differences and how they shape modern applications.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j3NrhhnGOOW86uQ_i71Jsg.png" /></figure><p>When I first started learning Java, I kept bumping into three terms,</p><ol><li><strong>POJO</strong></li><li><strong>Java Bean</strong></li><li><strong>Spring Bean</strong></li></ol><p>They sounded similar, and honestly, I thought they were just different names for the same thing. But as I dug deeper, I realized they’re like different <strong>stages of construction</strong> when building a house.</p><p>In this blog, let’s walk through their <strong>history</strong>, <strong>differences</strong>, and use a <strong>house analogy</strong> to finally clear up the confusion.</p><h3>A Quick History</h3><p><strong>POJO (Plain Old Java Object)</strong></p><ul><li>Coined around <strong>2000</strong> by Martin Fowler and others to simplify Java development.</li><li>A reaction against heavyweight Enterprise Java Beans (EJB).</li><li>Idea: keep objects plain, with no ties to frameworks.</li></ul><p><strong>Java Bean</strong></p><ul><li>Introduced in the <strong>1990s</strong> as a <em>component model</em> for Java.</li><li>Goal: make classes reusable in tools like GUI builders (think drag-and-drop in early IDEs).</li></ul><p><strong>Spring Bean</strong></p><ul><li>Came with the <strong>Spring Framework</strong>.</li><li>Objects managed by Spring’s IoC container lifecycle, dependencies, and configuration are handled automatically.</li></ul><h3>🧱 POJO (Plain Old Java Object)</h3><p>Think of a <strong>POJO</strong> as <strong>bricks and cement</strong>. They’re the raw materials. You can build anything with them, and there are no strict rules.</p><ul><li>It’s just a regular Java class.</li><li>No special annotations or framework dependencies.</li><li>You define fields, constructors, and methods however you like.</li></ul><p><em>POJOs are simple and flexible, like raw building materials.</em></p><pre>public class Person {<br>    private String name;<br>    private int age;<br><br>    public Person(String name, int age) {<br>        this.name = name;<br>        this.age = age;<br>    }<br><br>    public void sayHello() {<br>        System.out.println(&quot;Hello, my name is &quot; + name);<br>    }<br>}</pre><h3>🧩 Java Bean</h3><p>Now imagine those raw materials are shaped into <strong>standardized building blocks,</strong> uniform-sized bricks, pre-fabricated panels, or windows that can fit into any house design. That’s a <strong>Java Bean</strong>.</p><p><strong>Rules of a Java Bean:</strong></p><ol><li>Must have a <strong>no-arg constructor.</strong></li><li>Fields should be <strong>private</strong>.</li><li>Provide <strong>getters and setters</strong> for access.</li><li>Should be <strong>Serializable</strong> (in older specs).</li></ol><p><em>Java Beans make your classes predictable and reusable, like </em><strong><em>standardized blocks</em></strong><em> in construction.</em></p><pre>import java.io.Serializable;<br><br>public class EmployeeBean implements Serializable {<br>    private String name;<br>    private int salary;<br><br>    public EmployeeBean() {<br>        // no-arg constructor<br>    }<br><br>    public String getName() {<br>        return name;<br>    }<br><br>    public void setName(String name) {<br>        this.name = name;<br>    }<br><br>    public int getSalary() {<br>        return salary;<br>    }<br><br>    public void setSalary(int salary) {<br>        this.salary = salary;<br>    }<br>}</pre><h3>🏠 Spring Bean</h3><p>Finally, let’s assemble those materials into a <strong>house</strong>. Here, the <strong>architect/contractor (Spring)</strong> takes care of:</p><ul><li>Using the right building blocks (POJOs, Java Beans).</li><li>Managing wiring and plumbing (dependencies).</li><li>Ensuring the house is ready to live in (object lifecycle).</li></ul><p>That’s what a <strong>Spring Bean</strong> is, any object managed by the<strong> Spring IoC container</strong>.</p><ul><li>You don’t manually create it with <strong><em>new</em></strong>.</li><li>Spring creates and wires it up for you.</li><li>Defined using <strong><em>Component, Service, Repository……</em></strong></li></ul><p>Here, <strong><em>UserService</em></strong> is a <strong>Spring Bean</strong>. Spring acts like the contractor who delivers a fully functional house when you need it.</p><pre>import org.springframework.stereotype.Service;<br><br>@Service<br>public class UserService {<br>    public String greetUser(String name) {<br>        return &quot;Hello, &quot; + name + &quot;! Welcome to Spring.&quot;;<br>    }<br>}</pre><h3>POJO vs Java Bean vs Spring Bean</h3><p>Here’s the side-by-side comparison in construction terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7gRzI_N3n4qx-Gu0pqCm3w.png" /></figure><h3>Conclusion</h3><p>At the end of the day:</p><ul><li><strong>Every Spring Bean is a POJO.</strong></li><li><strong>Not every POJO is a Java Bean.</strong></li><li><strong>Not every Java Bean is a Spring Bean.</strong></li></ul><p>Just like in construction:</p><ul><li><strong>POJO =&gt; raw bricks and cement 🧱</strong></li><li><strong>Java Bean =&gt; pre-fabricated blocks 🧩</strong></li><li><strong>Spring Bean =&gt; a complete house 🏠 built and managed by the contractor (Spring).</strong></li></ul><p>So next time you encounter these terms, remember they’re not just Java jargon, they’re stages in the evolution of how objects are modeled and managed in modern applications.</p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e49ac263566a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka Retry & DLT in Spring Boot: A Practical Guide]]></title>
            <link>https://medium.com/@moshdev2213/kafka-retry-dlt-in-spring-boot-a-practical-guide-4b2b5e931710?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b2b5e931710</guid>
            <category><![CDATA[dead-letter-queue]]></category>
            <category><![CDATA[resilience]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 02:36:29 GMT</pubDate>
            <atom:updated>2025-09-03T02:36:29.638Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Learn how to implement retry mechanisms and dead letter topics in Kafka consumers using Spring Boot, with code examples.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ar-njkddiyS_3bW6vIl8oQ.png" /><figcaption>Banner Image</figcaption></figure><h3>Quick Recap: Why Do We Need Retries and DLTs?</h3><p>In the previous <a href="#">Kafka 101</a> and <a href="#">Retry/DLT</a> theory blogs, we explored how Kafka enables scalable event-driven systems and how retries and dead letter topics help handle message failures gracefully.</p><p>But what happens when:</p><ul><li>A message has a <strong>transient error</strong> (e.g., DB is down)?</li><li>A message is <strong>poisoned</strong> (e.g., bad payload or validation fail)?</li></ul><p>In this practical guide, we’ll implement a <strong>retry and dead letter topic (DLT) </strong>flow using<strong> Spring Boot </strong>and<strong> Spring Kafka</strong>.</p><p>You’ll learn how to:</p><ul><li>Configure retry logic and backoff strategies</li><li>Route unprocessable messages to a DLT</li></ul><p>By the end, you’ll have a resilient Kafka consumer setup that can handle real-world failure scenarios with confidence.</p><h3>Project Structure</h3><p>Here’s our folder structure. This is a single Spring Boot project that contains both the producer and consumer logic for easier getting started.<br><em>Note:- the basic project creation, like things, are not included here, solely focused on the Kafka scenario :-)</em></p><pre>kafka-error-handling/<br>├── README.md<br>├── pom.xml<br>└── src/<br>    ├── main/<br>    │   ├── java/<br>    │   │   └── com/dltdemo/<br>    │   │       ├── KafkaDemoApplication.java<br>    │   │       ├── config/<br>    |   |       |   └──KafkaConfig.java<br>    │   │       ├── consumer/<br>    |   |       |   └──KafkaMessageConsumer.java<br>    │   │       ├── controller/<br>    |   |       |   └──EventController.java<br>    │   │       ├── dto/<br>    |   |       |   └──User.java<br>    │   │       ├── publisher/<br>    |   |           └──KafkaMessagePublisher.java<br>    │   └── resources/<br>    │       ├── application.properties<br>    │       ├── application.yml<br>    └── test/<br>        └── java/com/dltdemo/<br>            ├── KafkaDemoApplicationTests.java</pre><h4>Application.yml</h4><p>This configures our <strong>producer</strong> and <strong>consumer</strong> with JSON serializers and deserializers. It also trusts the DTOs from our <strong><em>com.dltdemo.com</em></strong> package.</p><pre>spring:<br>  kafka:<br>    producer:<br>      key-serializer: org.apache.kafka.common.serialization.StringSerializer<br>      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer<br>    consumer:<br>      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer<br>      value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer<br>      group-id: demo<br>      auto-offset-reset: latest<br>      properties:<br>        spring:<br>          json:<br>            trusted:<br>              packages: com.dltdemo.dto</pre><h4>Event Publishing</h4><p>A simple <strong>REST </strong>endpoint allows you to send test data to Kafka. This publishes a <strong><em>User </em></strong>object to the Kafka topic. The Kafka payload structure is also shown below as the <strong><em>User </em></strong>which is in the DTO package.</p><pre>@RestController<br>@RequiredArgsConstructor<br>@RequestMapping(&quot;/api/events&quot;)<br>public class EventController {<br><br>    private final KafkaMessagePublisher publisher;<br><br>    @PostMapping<br>    public ResponseEntity&lt;String&gt; publishEvent(@RequestBody User user) {<br>        publisher.sendEventsToTopic(user);<br>        return ResponseEntity.ok(&quot;Event published to Kafka&quot;);<br>    }<br>}</pre><pre>@Service<br>@RequiredArgsConstructor<br>public class KafkaMessagePublisher {<br><br>    @Value(&quot;${app.topic.name}&quot;)<br>    private String topicName;<br><br>    private final KafkaTemplate&lt;String, User&gt; kafkaTemplate;<br><br>    public void sendEventsToTopic(User user) {<br>        kafkaTemplate.send(topicName, user);<br>    }<br>}</pre><pre>@Data<br>@AllArgsConstructor<br>@NoArgsConstructor<br>public class User {<br>    private String firstName;<br>    private String lastName;<br>    private String email;<br>    private String ipAddress;<br>}</pre><h4>Retry + DLT Enabled Consumer</h4><p>This is where the magic happens. By using the “<strong><em>@RetryableTopic”</em></strong> annotation, Spring will create retry topics (<em>topicName-retry-x</em>) and a final DLT topic (<em>topicName-dlt</em>).</p><pre>@Service<br>@Slf4j<br>public class KafkaMessageConsumer {<br><br>    @RetryableTopic(attempts = &quot;4&quot;)<br>    @KafkaListener(topics = &quot;${app.topic.name}&quot;, groupId = &quot;dltdemo-group&quot;)<br>    public void consumeEvents(User user, <br>                              @Header(KafkaHeaders.RECEIVED_TOPIC) String topic, <br>                              @Header(KafkaHeaders.OFFSET) long offset) {<br>        try {<br>            log.info(&quot;Received: {} from {} offset {}&quot;, <br>                new ObjectMapper().writeValueAsString(user), topic, offset);<br><br>            // Simulate a failure for certain IPs<br>            List&lt;String&gt; restrictedIpList = List.of(&quot;32.241.244.236&quot;, &quot;15.55.49.164&quot;);<br>            if (restrictedIpList.contains(user.getIpAddress())) {<br>                throw new RuntimeException(&quot;Invalid IP Address received !&quot;);<br>            }<br><br>        } catch (JsonProcessingException e) {<br>            log.error(&quot;Error parsing user&quot;, e);<br>        }<br>    }<br><br>    // DLT handler method<br>    @DltHandler<br>    public void listenDLT(User user, <br>                          @Header(KafkaHeaders.RECEIVED_TOPIC) String topic, <br>                          @Header(KafkaHeaders.OFFSET) long offset) {<br>        log.warn(&quot;DLT Received : {} , from {} , offset {}&quot;, user.getFirstName(), topic, offset);<br>    }<br>}</pre><p><strong>How Above Works:-</strong></p><ul><li><strong><em>@RetryableTopic(attempts=“4”)</em></strong> Triggers up to 3 retries before giving up. <em>(1 initial attempt + 3 retry attempts)</em></li><li>Retry topics are auto-created with suffixes like <strong><em>topic-name-retry-0</em></strong>, <strong><em>topic-name-retry-1</em></strong>, and etc…..</li><li>If all retries fail, the message is routed to the Dead Letter Topic(<strong><em>topic-name-dlt)</em></strong>.</li><li><strong><em>@DltHandler</em></strong> captures messages sent to DLT for monitoring or manual recovery.</li></ul><h3>Running Kafka Locally</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*46dJiQgbH_FS8c6Ed4EyGA.png" /><figcaption>The image shows the ultimate flow of executions</figcaption></figure><p>Okay, now let&#39;s run the application for this first, we need to setup Kafka and its prerequisites. This can be easily done by running a Docker Compose file.<br>So, to test retries and Dead Letter Topics (DLT) locally, we can spin up <strong>Kafka</strong>, <strong>Zookeeper</strong>, and <strong>Confluent Control Center</strong> using Docker.</p><p>Here’s the <strong><em>docker-compose.yaml</em></strong>:</p><pre>version: &quot;3&quot;<br><br>services:<br>  zookeeper:<br>    image: confluentinc/cp-zookeeper:5.4.0<br>    hostname: zookeeper<br>    container_name: zookeeper<br>    ports:<br>      - &quot;2181:2181&quot;<br>    environment:<br>      ZOOKEEPER_CLIENT_PORT: 2181<br>      ZOOKEEPER_TICK_TIME: 2000<br><br>  broker:<br>    image: confluentinc/cp-server:5.4.0<br>    hostname: broker<br>    container_name: broker<br>    depends_on:<br>      - zookeeper<br>    ports:<br>      - &quot;9092:9092&quot;<br>    environment:<br>      KAFKA_BROKER_ID: 1<br>      KAFKA_ZOOKEEPER_CONNECT: &quot;zookeeper:2181&quot;<br>      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT<br>      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092<br>      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1<br>      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0<br>      CONFLUENT_METRICS_ENABLE: &quot;true&quot;<br>      CONFLUENT_SUPPORT_CUSTOMER_ID: &quot;anonymous&quot;<br><br>  kafka-tools:<br>    image: confluentinc/cp-kafka:5.4.0<br>    hostname: kafka-tools<br>    container_name: kafka-tools<br>    command: [&quot;tail&quot;, &quot;-f&quot;, &quot;/dev/null&quot;]<br>    network_mode: &quot;host&quot;<br><br>  schema-registry:<br>    image: confluentinc/cp-schema-registry:5.4.0<br>    hostname: schema-registry<br>    container_name: schema-registry<br>    depends_on:<br>      - zookeeper<br>      - broker<br>    ports:<br>      - &quot;8081:8081&quot;<br>    environment:<br>      SCHEMA_REGISTRY_HOST_NAME: schema-registry<br>      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: &quot;zookeeper:2181&quot;<br><br>  control-center:<br>    image: confluentinc/cp-enterprise-control-center:5.4.0<br>    hostname: control-center<br>    container_name: control-center<br>    depends_on:<br>      - zookeeper<br>      - broker<br>      - schema-registry<br>    ports:<br>      - &quot;9021:9021&quot;<br>    environment:<br>      CONTROL_CENTER_BOOTSTRAP_SERVERS: &#39;broker:29092&#39;<br>      CONTROL_CENTER_ZOOKEEPER_CONNECT: &#39;zookeeper:2181&#39;<br>      CONTROL_CENTER_SCHEMA_REGISTRY_URL: &quot;http://schema-registry:8081&quot;<br>      CONTROL_CENTER_REPLICATION_FACTOR: 1<br>      CONTROL_CENTER_INTERNAL_TOPICS_PARTITIONS: 1<br>      CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS: 1<br>      CONFLUENT_METRICS_TOPIC_REPLICATION: 1<br>      PORT: 9021</pre><p>The above Docker Compose file runs,</p><ul><li><strong>Broker</strong> → Kafka server that stores messages in topics.</li><li><strong>Zookeeper</strong> → Manages Kafka cluster metadata.</li><li><strong>Kafka Tools</strong> → CLI utilities for topic management.</li><li><strong>Schema Registry</strong> → Manages Avro/JSON schemas (optional here).</li><li><strong>Control Center</strong> → Web UI for monitoring Kafka topics, consumers, and message flow.</li></ul><h4>How to Monitor Retries &amp; Dead Letter Topics</h4><p>Once the stack is running:</p><ol><li><strong>Start the services</strong></li></ol><pre>docker-compose up -d</pre><p>2.<strong> Open Control Center<br></strong>Visit:<strong><em> </em></strong><a href="http://localhost:9021/"><strong><em>http://localhost:9021</em></strong></a></p><p>3.<strong> Locate Your Topics</strong></p><ul><li>Find your main topic (e.g., <strong><em>user-events</em></strong>).</li><li>You’ll also see auto-created retry topics:</li></ul><pre>user-events-retry-0<br>user-events-retry-1<br>user-events-retry-2</pre><ul><li>And the Dead Letter Topic:</li></ul><pre>user-events-dlt</pre><p>4. <strong>Watch Retries in Action</strong></p><ul><li>Send a message that you know will fail validation.</li><li>You’ll see it appear in <strong><em>user-events-retry-0</em></strong>, then move to subsequent retry topics.</li><li>After the final retry, it will land in <strong><em>user-events-dlt</em></strong>.</li></ul><p>5. <strong>Inspect Dead Letter Messages</strong></p><ul><li>Click on the DLT topic in Control Center.</li><li>View message details, headers, and failure reasons.</li><li>Use this info for debugging and potential reprocessing.</li></ul><h3>Wrapping Up</h3><p>With just a few annotations and the right Kafka setup, we’ve built a <strong>resilient </strong>event-processing<strong> </strong>pipeline that can <strong>retry transient failures</strong> and capture bad messages for later analysis.</p><p>By combining “<strong><em>@RetryableTopic</em></strong>” and <strong><em>“@DltHandler”</em></strong> with monitoring, we get full visibility into message flow and failures without complex manual plumbing.</p><p>In short:</p><blockquote><strong><em>Retry smartly. Capture failures. Keep your consumers healthy.</em></strong></blockquote><h3>Additional Resources ✍</h3><ul><li><strong>Spring Kafka Documentation</strong>: <a href="https://spring.io/projects/spring-kafka">https://docs.spring.io/spring-kafka/reference/html/</a></li><li><strong>Dockerized Kafka Development Setup:</strong> <a href="https://developer.confluent.io/quickstart/kafka-docker/">https://developer.confluent.io/quickstart/kafka-docker/</a></li><li><strong>YouTube Demos:</strong></li><li><a href="https://youtu.be/aNBSd7T-RGA?si=Y7hIhC0pctZBlDz6">https://youtu.be/aNBSd7T-RGA?si=Y7hIhC0pctZBlDz6</a></li></ul><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b2b5e931710" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Apache Kafka and Spring Boot: A Beginner’s Guide]]></title>
            <link>https://medium.com/@moshdev2213/getting-started-with-apache-kafka-and-spring-boot-a-beginners-guide-a8a623ffa5de?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8a623ffa5de</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[pub-sub]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Sun, 24 Aug 2025 12:12:18 GMT</pubDate>
            <atom:updated>2025-08-24T12:16:38.123Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Build a real-time messaging pipeline using Kafka and Spring Boot, perfect for microservices</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LrGCaO9TpiVfu8gSufPuOw.png" /><figcaption>Banner Image</figcaption></figure><h3>Kafka in a Nutshell</h3><p>Before we begin, let&#39;s have a quick touch on what Kafka is and its simple flow. Apache Kafka is a <strong><em>distributed event streaming platform</em></strong> used to build real-time data pipelines and <strong><em>event-driven applications</em></strong>. Originally developed at LinkedIn, handling high-throughput, fault-tolerant, and decoupled message streams.<br>New to Kafka? Read my beginner’s Guide blog <a href="https://medium.com/@moshdev2213/kafka-101-a-beginners-guide-to-event-driven-thinking-d77e39c9aa98"><strong><em>Kafka:101</em></strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tenx72JEU3RGXYzf9qetoA.png" /><figcaption>A simple flow diagram of how Kafka components are interconnected</figcaption></figure><h3>Tools &amp; Stack</h3><p>Before we jump into the code, let’s gather our tools. We’ll be using Java with Spring Boot to write the applications, and Docker to run Kafka locally. This setup ensures you can easily replicate and test everything on your own machine.<br>✅️️ ️Java 21 (I am using this version )<br>✅ Spring Boot 3.x<br>✅ Apache Kafka (via Docker)<br>✅ Spring Kafka<br>✅ Curl/Postman for testing</p><h4>Step 1: Kafka and Zookeeper Setup with Docker</h4><p>We’ll spin up Kafka and Zookeeper locally using Docker Compose:</p><pre># docker-compose.yml<br>version: &#39;3&#39;<br>services:<br>  zookeeper:<br>    image: confluentinc/cp-zookeeper:latest<br>    ports:<br>      - &quot;2181:2181&quot;<br>    environment:<br>      ZOOKEEPER_CLIENT_PORT: 2181<br><br>  kafka:<br>    image: confluentinc/cp-kafka:latest<br>    ports:<br>      - &quot;9092:9092&quot;<br>    depends_on:<br>      - zookeeper<br>    environment:<br>      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181<br>      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092<br>      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1</pre><p>Run the above Docker Compose file with the command (make sure your Docker engine is up and running ) =&gt; <strong><em>docker-compose up -d</em></strong></p><h4>Step 2: Create Two Spring Boot Projects</h4><p>Let’s make two Spring Boot projects, one to <strong>produce</strong> messages and another to <strong>consume</strong> them. This helps simulate how real-world services interact in an event-driven ecosystem.</p><p>Below are the screenshots of how the Spring Boot project is initialized with the relevant dependencies ( note:- make sure to generate them and extract them into your desired directory) using <a href="https://start.spring.io/"><strong><em>https://start.spring.io/</em></strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DppGGzyM1tDeUy8jcZ0d0g.png" /><figcaption>The image shows the project creation of producer project</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBjk0Vdqo6foDCrR9z94sw.png" /><figcaption>The image shows the project creation of consumer project</figcaption></figure><h4>Step 3: Configure application.properties</h4><p>Producer — <strong><em>application.properties</em></strong></p><pre>spring.kafka.bootstrap-servers= localhost:9092<br><br>spring.kafka.producer.key-serializer= org.apache.kafka.common.serialization.StringSerializer<br>spring.kafka.producer.value-serializer= org.apache.kafka.common.serialization.JsonSerializer<br><br>app.topic.name= demo-topic</pre><p>Consumer — <strong><em>application.properties</em></strong></p><pre>spring.kafka.bootstrap-servers= localhost:9092<br><br>spring.kafka.consumer.group-id= demo-consumer-group<br>spring.kafka.consumer.auto-offset-reset= earliest<br>spring.kafka.consumer.enable-auto-commit= true<br><br>spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer<br>spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.JsonDeserializer<br><br>app.topic.name= demo-topic</pre><h4>Step 4: Build the Kafka Producer</h4><p>Now it’s time to write some actual code. Our producer will expose a simple REST API that accepts messages via HTTP and forwards them to Kafka. Below are the <em>KafkaProducer </em>and the <em>Controller </em>Classes.</p><p><strong><em>KafkaProducerService.java</em></strong></p><pre>@Service<br>public class KafkaProducerService {<br><br>    private final KafkaTemplate&lt;String, String&gt; kafkaTemplate;<br><br>    @Value(&quot;${app.topic.name}&quot;)<br>    private String topic;<br><br>    public KafkaProducerService(KafkaTemplate&lt;String, String&gt; kafkaTemplate) {<br>        this.kafkaTemplate = kafkaTemplate;<br>    }<br><br>    public void sendMessage(String message) {<br>        kafkaTemplate.send(topic, message);<br>        System.out.println(&quot;Sent message: &quot; + message);<br>    }<br>}</pre><p><strong><em>KafkaProducerController.java</em></strong></p><pre>@RestController<br>@RequestMapping(&quot;/api/kafka&quot;)<br>public class KafkaProducerController {<br><br>    private final KafkaProducerService producerService;<br><br>    public KafkaProducerController(KafkaProducerService producerService) {<br>        this.producerService = producerService;<br>    }<br><br>    @PostMapping(&quot;/publish&quot;)<br>    public ResponseEntity&lt;String&gt; publish(@RequestParam String message) {<br>        producerService.sendMessage(message);<br>        return ResponseEntity.ok(&quot;Message published successfully!&quot;);<br>    }<br>}</pre><h4>Step 5: Build the Kafka Consumer</h4><p>Once our producer is ready to send messages, we need something to listen for them. That’s where our consumer comes in. It will automatically receive and log messages published to Kafka, allowing us to verify everything works end to end.</p><p><strong><em>KafkaConsumerService.java</em></strong></p><pre>@Service<br>public class KafkaConsumerService {<br><br>    @KafkaListener(<br>      topics = &quot;${app.topic.name}&quot;, <br>      groupId = &quot;${spring.kafka.consumer.group-id}&quot;<br>    )<br>    public void listen(String message) {<br>        System.out.println(&quot;Received message: &quot; + message);<br>    }<br>}</pre><h4>Step 6: Create a Sample User DTO</h4><p>Include the below DTO class in both of your producer and consumer projects ( note: — this is not the best practice, but fine for a getting started project)</p><pre>@Data<br>@AllArgsConstructor<br>@NoArgsConstructor<br>public class User {<br>    private String name;<br>    private String email;<br>}</pre><h4>Step 7: Run and Test</h4><p>Okay, now let&#39;s run and test our project.</p><ol><li>Start Kafka using Docker.</li><li>Run your <em>P</em><strong><em>roducer</em></strong><em> </em>and <em>C</em><strong><em>onsumer</em></strong><em> </em>Spring Boot apps</li><li>Use Curl or Postman to send a message</li><li>Watch your <strong><em>Consumer </em></strong>logs</li></ol><pre>curl -X POST &quot;http://localhost:8080/api/kafka/publish?message=hello-kafka&quot;</pre><h4>Final Thoughts</h4><p>If you’ve followed along until this point, awesome work!!! You’ve just built your first Kafka-based messaging pipeline using Spring Boot.</p><p>This kind of architecture is widely used in financial systems, e-commerce platforms, and real-time analytics. Once you’re comfortable with the basics, you can start exploring more advanced patterns.</p><p>I’ve attached a sample source code repository. This repository goes a step further by running a separate shared Maven module along with Kafka and Zookeeper without using Docker. Feel free to fork or clone the repository.</p><p><a href="https://github.com/moshdev2213/springboot-kafka-pubsub-quickstart">https://github.com/moshdev2213/springboot-kafka-pubsub-quickstart</a></p><h3>What’s Next?</h3><p>Let&#39;s go deeper, more content will be published in the near future :</p><ul><li>Kafka + Avro with Schema Registry</li><li>Kafka Streams for real-time processing</li><li>Spring Cloud Stream for declarative pipelines</li></ul><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me a mail at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8a623ffa5de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Big-O Notation: Time, Space, and Efficiency]]></title>
            <link>https://medium.com/@moshdev2213/big-o-notation-time-space-and-efficiency-a23363396953?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a23363396953</guid>
            <category><![CDATA[time-complexity]]></category>
            <category><![CDATA[big-o-notation]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[space-complexity]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Wed, 20 Aug 2025 15:03:16 GMT</pubDate>
            <atom:updated>2025-08-20T15:03:16.808Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A simple breakdown of Big-O Notation, the key to understanding your code’s performance.</em></p><p>Have you ever written code that <em>worked</em>… but somehow felt <em>slow</em>?<br>That’s where <strong>Big-O Notation</strong> comes in. Think of it as a <strong>time-travel machine for your code, </strong>it predicts how your program will behave as the input grows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SitVoo17V7FK_bb0-YAE8Q.png" /><figcaption>Banner Image</figcaption></figure><h3>What is Big-O Notation?</h3><p>Big-O is a way to describe how <strong>fast (or slow)</strong> an algorithm grows as the input size <strong><em>(n)</em></strong> increases.</p><p>1. It’s <strong>not</strong> about exact numbers.<br>2. It’s about <strong>trends</strong>.</p><p>Imagine this:</p><ul><li>You’re searching for a friend in a WhatsApp group of 10 people. Easy.</li><li>Now in a group of 10,000? Suddenly not so fun.</li></ul><p>Big-O helps us say:</p><ul><li>“This search takes <strong>linear time</strong> (O(n))”</li><li>or “This search takes <strong>logarithmic time</strong> (O(log n))”</li></ul><h3>Asymptotic Notation</h3><p>Big-O is actually part of a bigger family called <strong>Asymptotic Notation</strong>. When computer scientists analyze efficiency, they don’t measure <em>seconds.</em> Instead, they look at <strong>how performance scales</strong> as input grows.</p><p>The three main notations are:</p><ul><li><strong>Big-O (O)</strong> → Upper bound (<strong>worst case</strong>)</li><li><strong>Big-Θ (Θ)</strong> → Tight bound (<strong>typical case</strong>)</li><li><strong>Big-Ω (Ω)</strong> → Lower bound (<strong>best case</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_CLJcFafxoQ3wKv7VAgkOw.png" /></figure><h4>1. Big-O (O): Worst Case</h4><p>Big-O gives us the <strong>maximum growth rate</strong> of an algorithm.<br> It answers: <em>“How bad can this get?”</em></p><p>Example: <strong>Linear Search</strong> in an array of size <strong>n</strong>.</p><ul><li>Worst case: Found at the end → <em>O(n)</em></li></ul><h4>2. Big-Ω (Ω): Best Case</h4><p>Big-Ω gives the <strong>minimum growth rate</strong>.<br> It answers: <em>“How good can this get?”</em></p><p>Example: <strong>Linear Search</strong> again.</p><ul><li>Best case: Target is at index 0 → Ω(1)</li></ul><h4>3. <strong>Big-Θ </strong>(Θ): Tight Bound</h4><p><strong>Big-Θ</strong> describes the <strong>exact growth rate</strong> when best and worst are similar.</p><p>Example: <strong>Finding the maximum in an array</strong></p><ul><li>Best case: <em>O(n)</em></li><li>Worst case: <em>O(n)</em></li><li>Tight bound = Θ<em>(n)</em></li></ul><h4>Common Big-O Complexities (With Relatable Analogies)</h4><ul><li><strong>O(1) — Constant Time:</strong><br>Like checking who’s online right now, doesn’t matter if you have 10 friends or 10,000 it’s instant.</li><li><strong>O(log n) — Logarithmic Time:</strong><br>Like opening a phone book and cutting the search space in half each time. <em>(Binary Search)</em></li><li><strong>O(n) — Linear Time:</strong><br> Scanning through every name in your class attendance list.</li><li><strong>O(n log n) — Linearithmic Time:</strong><br>Sorting your chess pieces quickly using “divide and conquer” <em>(Merge Sort).</em></li><li><strong>O(n²) — Quadratic Time:</strong><br>Comparing every person with everyone else to find “best friend pairs” <em>(like nested loops).</em></li><li><strong>O(2ⁿ) — Exponential Time:</strong><br>Trying every possible chess move combination to <em>find the best strategy</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENAP16Z-YXbzEebQllXFYA.jpeg" /><figcaption>Chart shows various complexities using Big-O notation (credits: <a href="https://medium.com/u/b7b54430a021">Tarry Singh</a>)</figcaption></figure><h4>Visual Growth Comparison</h4><p>The table below illustrates the <strong>growth rate of different algorithms</strong> as the size of the input data, denoted by <strong>n</strong>, increases. It helps visualize how an algorithm’s performance, or “complexity,” scales with larger inputs. The values in the table represent the <strong>approximate number of operations</strong> an algorithm might perform for a given number of elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*Yca8dmvPx8or21_Wwzuwng.png" /><figcaption>The table below illustrates the <strong>growth rate of different algorithms</strong></figcaption></figure><h3>How to Analyze Code Yourself</h3><h4>Quick Math Rules</h4><ol><li><strong>Ignore constants:</strong> O(2n) → O(n).</li><li><strong>Ignore smaller terms:</strong> O(n² + n) → O(n²).</li><li><strong>Focus on growth:</strong> For large inputs, the biggest term dominates.</li></ol><h4>1. Look at loops</h4><p>🔴 <strong>One loop → O(n)</strong></p><pre>function printNumbers(arr) {<br>    for (let i = 0; i &lt; arr.length; i++) {<br>        console.log(arr[i]); // Runs n times<br>    }<br>}<br>// Time complexity: O(n)</pre><p><strong>Explanation:</strong><br>The loop runs <strong>once for each element</strong> in the array. If the array has <strong>n</strong> elements, the loop executes <strong>n </strong>times. That’s why it’s <strong>O(n),</strong> it grows linearly with the input size.</p><p>🔴 <strong>Nested loop → O(n²)</strong></p><pre>function printPairs(arr) {<br>    for (let i = 0; i &lt; arr.length; i++) {<br>        for (let j = 0; j &lt; arr.length; j++) {<br>            console.log(arr[i], arr[j]); // Runs n * n times<br>        }<br>    }<br>}<br>// Time complexity: O(n²)</pre><p><strong>Explanation:</strong><br>The <strong>outer loop</strong> runs <strong>n </strong>times, and for <em>each</em> outer loop iteration, the <strong>inner loop</strong> runs <strong>n </strong>times.<br> So total =&gt; <strong>n * n = n²</strong>.<br> This is quadratic growth → performance drops fast as input size increases.</p><h4>2. Look for divide-and-conquer</h4><p>🔴 <strong>Binary search → O(log n)</strong></p><pre>function binarySearch(arr, target) {<br>    let left = 0, right = arr.length - 1;<br>    while (left &lt;= right) {<br>        let mid = Math.floor((left + right) / 2);<br>        <br>        if (arr[mid] === target) return mid;<br>        else if (arr[mid] &lt; target) left = mid + 1;<br>        else right = mid - 1;<br>    }<br>    return -1;<br>}<br>// Time complexity: O(log n)</pre><p><strong>Explanation:</strong><br>Each step cuts the search space <strong>in half</strong>.</p><ul><li>Start with <strong>n </strong>items → after 1 step, <strong>n/2 </strong>→ after 2 steps, <strong>n/4 </strong>→ … until just 1 item.<br>So the number of steps =&gt; <strong>log₂(n)</strong>. That’s why binary search is <strong>O(log n)</strong>.</li></ul><p>🔴 <strong>Merge sort → O(n log n)</strong></p><pre>function mergeSort(arr) {<br>    if (arr.length &lt;= 1) return arr;<br>    let mid = Math.floor(arr.length / 2);<br>    let left = mergeSort(arr.slice(0, mid));<br>    let right = mergeSort(arr.slice(mid));<br>    return merge(left, right);<br>}<br><br>function merge(left, right) {<br>    let result = [];<br>    let i = 0, j = 0;<br>    while (i &lt; left.length &amp;&amp; j &lt; right.length) {<br>        if (left[i] &lt; right[j]) result.push(left[i++]);<br>        else result.push(right[j++]);<br>    }<br>    return result.concat(left.slice(i)).concat(right.slice(j));<br>}<br>// Time complexity: O(n log n)</pre><p><strong>Explanation:</strong></p><ul><li>The array is split in half <strong>log n times</strong> (divide step).</li><li>At each level, merging takes <strong>O(n)</strong> operations.<br>So total work = <strong>O(nlog n)</strong>. This is why efficient sorting algorithms beat bubble sort or insertion sort for big data.</li></ul><h4>3. Add or multiply steps</h4><p>🔴 <strong>Do step A (O(n)) and then step B (O(log n)) → O(n + log n) = O(n)</strong></p><pre>function example(arr, target) {<br>    // Step A: O(n)<br>    for (let i = 0; i &lt; arr.length; i++) {<br>        console.log(arr[i]);<br>    }<br>    // Step B: O(log n)<br>    let index = binarySearch(arr, target);<br>    return index;<br>}<br>// Time complexity: O(n) + O(log n) = O(n)</pre><p><strong>Explanation:</strong><br>When algorithms run <strong>one after the other</strong>, you <strong>add</strong> their complexities.<br> Here:</p><ul><li>Step A scans all items → O(n).</li><li>Step B binary searches → O(log n).<br> Final = <strong>O(n + log n)</strong>, but since <strong>n </strong>dominates, it simplifies to <strong>O(n)</strong>.</li></ul><p>🔴 <strong>Nested → multiply (O(n) × O(log n) = O(n log n))</strong></p><pre>function exampleNested(arr, target) {<br>    for (let i = 0; i &lt; arr.length; i++) { // O(n)<br>        binarySearch(arr, target);          // O(log n) inside loop<br>    }<br>}<br>// Time complexity: O(n * log n) = O(n log n)</pre><p><strong>Explanation:</strong><br>When algorithms are <strong>nested</strong>, you <strong>multiply</strong> their complexities.<br> Here:</p><ul><li>Outer loop runs <strong>n </strong>times.</li><li>Inside each iteration, binary search runs in <strong>O(log n)</strong>.<br> So total =&gt; <strong>n* log n = O(n log n)</strong>.</li></ul><h3>Final Thoughts</h3><p>Big-O, Big-Ω, and Big-Θ are like different camera angles for viewing your algorithm:</p><ul><li><strong>Big-O → Worst case.</strong></li><li><strong>Big-Ω → Best case.</strong></li><li><strong>Big-Θ → Typical case.</strong></li></ul><p>Next time you write a loop, ask yourself:</p><ul><li>“What’s my Big-O?”</li><li>“Is there a tighter bound?”</li></ul><p>That’s <strong>asymptotic thinking</strong>.</p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a23363396953" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka 101: A Beginner’s Guide to Event-Driven Thinking]]></title>
            <link>https://medium.com/@moshdev2213/kafka-101-a-beginners-guide-to-event-driven-thinking-d77e39c9aa98?source=rss-f26c4e70ab1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d77e39c9aa98</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <dc:creator><![CDATA[Shabeer Mohomad]]></dc:creator>
            <pubDate>Tue, 19 Aug 2025 13:30:47 GMT</pubDate>
            <atom:updated>2025-08-19T13:30:47.328Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A Beginner-Friendly Introduction to Event Streaming For Developers</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDiTGKUAyqykd1FRtxZCTg.png" /><figcaption>Banner Image</figcaption></figure><h3>The Story: A Day in the Life of ShopNow</h3><p>Okay, let&#39;s understand the Kafka concepts via a small story based on a growing e-commerce platform named <strong><em>ShopNow.</em></strong></p><p>One sunny afternoon, a customer named <strong>Emma</strong> visits the ShopNow website, adds a few items to her cart, and places an order. Behind the scenes, a lot happens:</p><ol><li>The <strong>Order Service</strong> confirms her order.</li><li>The <strong>Inventory Service</strong> updates the stock.</li><li>The <strong>Billing Service</strong> charges her card.</li><li>The <strong>Shipping Service</strong> starts preparing her package.</li><li>The <strong>Notification Service</strong> sends her a confirmation email and SMS.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0a3iG60RWUAI-Rw1pxpcgQ.png" /><figcaption>Image shows how the ShopNow services are tightly coupled during the original way of communication via HTTP</figcaption></figure><p>ShopNow originally was using HTTP for every service call, Overtime they faced issues like:</p><ul><li>Services becoming tightly coupled</li><li>Failures in one service affecting others</li><li>Hard to scale and evolve independently</li></ul><p>They needed something <strong>decoupled</strong>, <strong>asynchronous</strong>, and <strong>reliable</strong>, and they also had the question of how to keep all these services <strong>synchronized in real time.</strong></p><p>This is where <strong>Apache Kafka</strong> becomes the silent superhero.</p><h3>What is Apache Kafka?</h3><p>Apache Kafka is a <strong>distributed event streaming platform</strong> used to build <strong>real-time, loosely coupled systems</strong>.</p><p>Imagine Kafka as a <strong>central nervous system</strong> for your microservices, it helps them communicate through <strong>events</strong> instead of direct API calls.</p><p>Alright, before moving forward, let&#39;s understand how Kafka works under the hood, and let’s expand on its <strong>core architecture building blocks</strong>. You don’t need to be an expert in distributed systems to follow along, just keep Emma’s order story in mind!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tenx72JEU3RGXYzf9qetoA.png" /><figcaption>A simple image showcasing the core components of Kafka</figcaption></figure><p>Let&#39;s see how each of these above components can relate to our scenario.</p><p><strong>🔹 Producer</strong><br> A <strong>producer</strong> is any application or service that sends (publishes) data to Kafka. In our ShopNow platform, the <strong>Order Service</strong> acts as a producer. When Emma places her order, the Order Service creates an event (<em>order-created)</em> and sends it to Kafka so other services can respond accordingly.</p><p><strong>🔹 Consumer</strong><br> A <strong>consumer</strong> reads (subscribes to) data from Kafka topics. In ShopNow, services like <strong>Inventory</strong>, <strong>Billing</strong>, <strong>Notification, </strong>and <strong>Shipping </strong>are consumers. They each listen for new order events and take action, e.g., Inventory reduces the stock, Billing charges Emma’s card, and Notification sends her a confirmation email.</p><p><strong>🔹 Broker</strong><br> A <strong>Kafka broker</strong> is a Kafka server that receives, stores, and delivers messages. It’s the backbone of message handling. In our story, think of the broker as a <strong>post office</strong>: the Order Service drops Emma’s order event into the system, and the broker ensures it’s safely delivered to all interested services.</p><p><strong>🔹 Topic</strong><br> A <strong>topic</strong> is a named stream or category in Kafka that stores related messages. ShopNow might have topics like <em>order-created</em>, <em>payment-processed</em>, <em>shipment-started, stock-updated, and notification-sent. </em>When Emma’s order is placed, it gets published to the <em>relevant </em>topics, which multiple services can subscribe to.</p><p><strong>🔹 Partition</strong><br> Kafka splits each topic into <strong>partitions</strong>, which allow for <strong>parallelism</strong> and <strong>scalability</strong>. For example, if many customers place orders at the same time, the <em>order-created</em> topic’s partitions can handle multiple orders simultaneously.</p><p><strong>🔹 Offset</strong><br> An <strong>offset</strong> is a unique identifier for each message within a partition. It lets consumers know which messages they’ve already processed. So if the Inventory Service consumes Emma’s order at <em>offset 42</em>, it can resume later from <em>offset 43</em> without duplicating work if the system restarts.</p><p><strong>🔹 Consumer Group</strong><br> A <strong>consumer group</strong> is a group of consumers that work together to read messages from a topic’s partitions. In ShopNow, the <strong>Billing Service</strong> may scale horizontally with three instances, each part of the same consumer group. Kafka will balance the workload, ensuring Emma’s order is handled by just one instance.</p><p><strong>🔹 ZooKeeper</strong> <em>(legacy)</em><br> Kafka traditionally used <strong>ZooKeeper</strong> to manage cluster metadata, broker coordination, and leader election. Furthermore, this ensures the Kafka cluster is aware and healthy while processing orders.</p><h3>How Messages Flow in Kafka</h3><p>Based on the learnings from the Kafka component, let’s now see how ShopNow’s traditional approach can be migrated with Kafka processing and how Emma’s order flow changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lxTbkKV3p99zrghrJazK2Q.png" /><figcaption>Image shows how traditional approach is migrated into Kafka approach</figcaption></figure><ol><li>Order Service<strong> publishes</strong> an <em>OrderPlaced </em>event to the <em>order-created</em> topic.</li><li><strong>Kafka Broker </strong>stores the event in a partition of the topic.</li><li><strong>Consumer services</strong> (Inventory, Billing, Shipping, Notification) <strong>subscribe</strong> to the topic and <strong>pull the event</strong>.</li><li>Each service <strong>processes the event</strong> and <strong>commits the offset</strong> after successful processing.</li><li>Each service <strong>publishes </strong>its event on a new topic:<br>🐋 Inventory Service → <em>stock-updated</em><br>🐋 Billing Service → <em>payment-processed</em><br>🐋 Shipping Service → <em>shipment-started</em><br>🐋 Notification Service → <em>notification-sent</em></li><li>Order Service <strong>consumes</strong> these downstream events to <strong>track progress</strong> and <strong>update order status</strong>.</li><li>Once all are processed, Order Service <strong>confirms the order</strong> and updates the UI.</li></ol><h3><strong>Wrapping Up</strong></h3><p><strong>Apache Kafka</strong> is far more than just a tech term; it represents a powerful concept where systems efficiently communicate through <strong>events, </strong>enabling:</p><ul><li><strong>Asynchronous</strong> — real-time but not blocking</li><li><strong>Loose Coupling</strong> — services don’t depend on each other</li><li><strong>Failure Isolation</strong> — one service can fail, others continue</li><li><strong>Replayabl</strong>e — reprocess messages anytime</li><li><strong>Scalable</strong> — scale consumers independently.</li></ul><p>So the next time you place an order online, think about how Kafka might be quietly powering it behind the scenes. 🤗✌</p><h3>What’s Next?</h3><p>Worried about implementing Kafka in your projects? My blog, <em>“Getting Started with Apache Kafka and Spring Boot: A Beginner’s Guide,” </em>offers the guidance you need.</p><h3>Connect With Me ✌</h3><ul><li>Follow me on <strong>Github</strong>: <a href="https://github.com/moshdev2213"><em>#moshdev2213</em></a></li><li>Connect with me on <strong>LinkedIn</strong>: <a href="https://linkedin.com/in/mohommad-shabeer-88328226b">#moshdev2213</a></li><li>Drop me an email at <strong><em>moshdev2213@gmail.com</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d77e39c9aa98" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>