<?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 Rahul Bhattacharya on Medium]]></title>
        <description><![CDATA[Stories by Rahul Bhattacharya on Medium]]></description>
        <link>https://medium.com/@rahulbats?source=rss-24afceea655a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KtKjbfGmSeHTqFZf4Z8nkA.png</url>
            <title>Stories by Rahul Bhattacharya on Medium</title>
            <link>https://medium.com/@rahulbats?source=rss-24afceea655a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 17:13:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahulbats/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[Agent Swarms on Kafka: Coordination Without a Coordinator]]></title>
            <link>https://medium.com/@rahulbats/agent-swarms-on-kafka-coordination-without-a-coordinator-d358c61196b4?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d358c61196b4</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[apache-flink]]></category>
            <category><![CDATA[agent-swarm]]></category>
            <category><![CDATA[ai-workflow]]></category>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 17:23:15 GMT</pubDate>
            <atom:updated>2026-09-12T22:20:41.773Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Or: what happens when you make Kafka and Flink do the job LangGraph and Temporal usually do for a fleet of LLM agents.</em></p><p>Every multi-agent framework I looked at shares the same shape: a central orchestrator holds the workflow, and every worker has to know about it and report back. LangGraph, Temporal, CrewAI, the managed agent runtimes (Microsoft foundry managed agents and AWS bedrock agent core) — the names differ, the topology doesn’t. It’s a star, with the orchestrator at the middle and a request/response edge to every agent.</p><p>That’s fine until you need the thing a lot of real systems already have for free: independent scaling per agent, replay when something crashes, an audit trail that isn’t “check the logs and hope,” and the ability for a completely unrelated system — a fraud model, a BI dashboard — to see what happened without being wired into your orchestrator’s internals.</p><p>So I built the other topology: agents that never call each other, coordinated entirely through a Kafka log, with Flink doing the one piece of real cross-agent logic — the barrier that waits for every agent to finish before anyone acts on the result.</p><p>Here’s the design, running on Kafka and Flink, and what actually comes back out the other end.</p><h3>The use case</h3><p>I used insurance claims adjudication because it’s a clean scatter/gather problem: a claim needs a factual read (what happened, how much) and an independent legal read (what does the policy say), and only then can anyone decide.</p><p>Three agents:</p><ul><li>ClaimDataAgent — pulls the claim record, summarizes it, doesn’t editorialize about coverage</li><li>PolicyDocAgent — pulls the governing policy, surfaces the relevant clauses, limits, and exclusions</li><li>CoverageOrchestrator — reads both, decides COVERED / PARTIALLY COVERED / NOT COVERED, cites the clause, does the deductible math</li></ul><p>Each one is a small <a href="https://github.com/rahulbats/flinkswarm/blob/main/flinkswarm/llm.py">tool-calling agent</a> against a local Qwen 3 model — nothing exotic, just an OpenAI-compatible chat loop with a couple of tools per agent.</p><h3>The shape of it</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W3TyrFJ4-vDsCD5QP1pgbw.png" /></figure><p>Every arrow is a Kafka topic. Agents never call each other or the orchestrator — they only produce to and consume from topics.</p><p>Every arrow is a Kafka topic. claim_id is the message key everywhere, so the whole pipeline partitions cleanly without a reshuffle. Each agent is its own consumer group, so it scales independently — <a href="https://keda.sh/">KEDA</a> on consumer lag means a catastrophe-event volume spike just adds pods, no manual provisioning. And because the log retains everything, “why was this claim denied” is a replay of a claim_id, not an archaeology project through someone&#39;s logging.info calls.</p><p>The part worth writing up is the box in the middle.</p><h3>The barrier: a Flink function, not a SQL aggregate</h3><p>The barrier’s job is simple to state: buffer one result per agent, per claim, and only act once you have all of them.</p><p>A plain GROUP BY over the results topic can approximate this:</p><pre>INSERT INTO agent_synthesis_ready<br>SELECT claim_id, COUNT(*) AS agent_count,<br>       LISTAGG(agent_name || &#39;: &#39; || result, &#39; ||| &#39;) AS aggregated_payload<br>FROM agent_results_completed<br>GROUP BY claim_id;</pre><p>But it’s a running aggregate, not a barrier. Flink emits an updated row every time an agent reports (agent_count 1, then 2), so “have we seen everyone yet?” has to be re-checked downstream by the consumer, and the aggregation state for every claim sits around indefinitely unless you bolt on a TTL.</p><p>A ProcessTableFunction (PTF) — available on as of Flink 2.1 — does the job directly: Flink keeps a small piece of keyed state per claim_id, and the function calls collect() exactly once, the moment that state is complete. Here it is:</p><pre>@DataTypeHint(&quot;ROW&lt;claim_id STRING, aggregated_payload STRING&gt;&quot;)<br>public class AgentBarrier extends ProcessTableFunction&lt;Row&gt; {</pre><pre>    public static class BarrierState {<br>        public Map&lt;String, String&gt; responses = new TreeMap&lt;&gt;();<br>    }</pre><pre>    public void eval(<br>            Context ctx,<br>            @StateHint BarrierState state,<br>            @ArgumentHint(SET_SEMANTIC_TABLE) Row input,<br>            Integer expectedAgents) {</pre><pre>        String claimId = input.getFieldAs(&quot;key&quot;);     // partition key == claim_id<br>        String agentName = input.getFieldAs(&quot;agent_name&quot;);<br>        String result = input.getFieldAs(&quot;result&quot;);</pre><pre>        state.responses.put(agentName, result);</pre><pre>        int expected = (expectedAgents == null || expectedAgents &lt;= 0) ? 1 : expectedAgents;<br>        if (state.responses.size() &gt;= expected) {<br>            collect(Row.of(claimId, payload(claimId, state.responses)));<br>            state.responses.clear();<br>            ctx.clearAllState();   // forget the claim — a re-dispatch decides it anew<br>        }<br>    }<br>    // buildPayload / esc omitted — see the repo<br>}</pre><p>Called from SQL as:</p><pre>INSERT INTO `agent.synthesis.ready`<br>SELECT claim_id, aggregated_payload<br>FROM AgentBarrier(<br>  input          =&gt; TABLE `agent.results.completed` PARTITION BY `key`,<br>  expectedAgents =&gt; 2,<br>  uid            =&gt; &#39;flinkswarm-barrier-v4&#39;);</pre><p>Two properties fall out of doing it this way. It emits exactly once, on a genuine append stream — no upsert changelog, no “which of these rows for this claim is the real one” question for the consumer. And ctx.clearAllState() means the barrier forgets a claim the instant it decides it, so state stays proportional to claims currently in flight, not to every claim ever processed — and re-dispatching the same claim_id later is adjudicated fresh rather than silently dropped.</p><h3>Watching it actually decide something</h3><p>Dispatch a burst-pipe water damage claim:</p><pre>python -m flinkswarm.orchestrator dispatch \<br>  --claim CLM-1001 --prompt &quot;Adjudicate coverage for claim CLM-1001.&quot;</pre><p>ClaimDataAgent and PolicyDocAgent run in parallel, each producing one row to agent.results.completed. The barrier buffers both and emits one row the moment the second arrives. The orchestrator picks that up and runs the adjudication call. Here&#39;s what each agent actually produced, verbatim, for the same claim:</p><p>CLAIMDATAAGENT → AGENT.RESULTS.COMPLETED</p><p>Here is the structured summary for claim CLM-1001:</p><ul><li>Claimant: A. Rivera</li><li>Date of Loss: 2026–07–14</li><li>Peril: Water damage</li><li>Amount Claimed: $8,200.00</li><li>Line Items: hardwood floor replacement — $6,100.00; drywall + paint — $2,100.00</li><li>Adjuster Notes: Supply line burst under kitchen sink. Photos on file.</li></ul><p>Note: I’m the Claim Data agent and can only retrieve and summarize the claim record. I’m not able to adjudicate coverage — that requires policy terms, exclusions, and coverage analysis, which is outside my scope.</p><p>POLICYDOCAGENT → AGENT.RESULTS.COMPLETED</p><p>Governing Policy: POL-55 (Form HO-3)</p><p>Dwelling Limit$350,000Deductible$1,000Covered PerilsFire; Water damage (sudden &amp; accidental); Wind; TheftExclusionsFlood; Earth movement; Wear and tear; Neglect</p><p>Relevant clauses</p><ul><li>SEC-II-A — “Sudden and accidental discharge of water from a plumbing system is covered.”</li><li>SEC-IV-3 — “Losses caused by flood, surface water, or overflow of a body of water are excluded.”</li></ul><p>COVERAGEORCHESTRATOR → AGENT.DECISIONS.FINAL · DECISION: COVERED</p><p>“The claim is adjudicated as COVERED based on the specific cause of loss identified by the ClaimDataAgent: a ‘Supply line burst under kitchen sink.’ This event constitutes a ‘sudden and accidental discharge of water from a plumbing system,’ which is explicitly covered under Policy POL-55 (Form HO-3) per Clause SEC-II-A. The loss does not fall under the exclusions for flood, surface water, wear and tear, or neglect, as a burst supply line is an acute, accidental failure rather than gradual deterioration or external water intrusion. The total claimed amount is $8,200.00. Applying the policy’s $1,000 deductible results in a payable amount of $7,200.00. This amount is well within the $350,000 dwelling limit. No further follow-ups are required as the cause of loss is clearly documented in the adjuster notes and photos.”</p><p>Change the claim to one where the peril is flood on a policy with no flood endorsement, and the same pipeline comes back NOT COVERED, citing the exclusion clause instead. Nothing about the plumbing changed — the two agents just fed different facts into the same architecture.</p><h3>What’s next</h3><p>The demo is hand-wired — one orchestrator process, two worker processes, started by hand. The natural next step is an <a href="https://github.com/rahulbats/flinkswarm/blob/main/agent-spec.yaml">agent-spec.yaml</a> that describes the swarm declaratively (agents, tools, topics, expected agent count) and a Kubernetes operator that reconciles it — creates the topics, registers the Flink function and statement, deploys the agent containers, and lets <a href="https://keda.sh/">KEDA</a> handle the scaling. The spec for that is already sketched in the repo.</p><p>The other obvious next step, since everything is already an event: a guardrail layer (input scanning for prompt injection, output validation before a decision is trusted) and an eval harness that replays historical claims through a new model version to catch drift before it ships — both of which are just more consumers of topics that already exist. And because human corrections to a swarm decision can land on their own topic, you get a labeled, ever-growing fine-tuning dataset essentially for free, instead of having to stand up separate feedback-collection infrastructure.</p><h3>Try it</h3><p>The full thing — the agents, the Flink PTF, the Kubernetes/KEDA manifests, the setup scripts — is on GitHub.</p><p><a href="https://github.com/rahulbats/flinkswarm">github.com/rahulbats/flinkswarm</a></p><p>If you’ve fought flink PTFs before, or you think the “no point-to-point calls” framing is wrong for some case I haven’t hit yet, I’d like to hear about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d358c61196b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Talking to Your Kafka Topics: Querying Data with Natural Language using MCP and AI]]></title>
            <link>https://medium.com/@rahulbats/talking-to-your-kafka-topics-querying-data-with-natural-language-using-mcp-and-ai-6f45bff1385c?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f45bff1385c</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[mcp-protocol]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Wed, 30 Apr 2025 13:43:08 GMT</pubDate>
            <atom:updated>2025-04-30T13:43:08.567Z</atom:updated>
            <content:encoded><![CDATA[<p>Apache Kafka is a powerhouse for real-time data streams, but getting specific insights <em>out</em> of those streams often requires specialized knowledge. Writing queries using engines like Flink SQL, while powerful, isn’t always intuitive, especially for quick explorations or for users less familiar with the syntax.</p><p>What if you could just <em>ask</em> your Kafka topic a question in plain English and get the data you need?</p><p>Recently, I explored doing just that, leveraging the combination of an AI coding assistant (Cursor) and a concept called Model Centric Protocol (MCP) to interact with a Kafka topic hosted on Confluent Cloud. You can do the same with other AI chatbots like Claude desktop and <a href="https://block.github.io/goose/">Goose</a>. Here’s how it worked:</p><h3>The Scenario:</h3><p>Imagine a Kafka topic named sample_data_orders continuously receiving order events within the Confluent Cloud UI.</p><figure><img alt="The Confluent Cloud UI showing the ‘sample_data_orders’ topic receiving data." src="https://cdn-images-1.medium.com/max/897/0*QObQ281gEbiy_SCt" /></figure><p>Each event is a JSON message containing details like orderid, itemid, ordertime, and an address object with fields like city, state, and zipcode.</p><figure><img alt="Example JSON message structure within the topic, highlighting the nested ‘state’ field." src="https://cdn-images-1.medium.com/max/1024/0*hrfIgZOGmiUJ7AZY" /></figure><p>My goal: Find all the order records where the state field within the address object is equal to “State_94”.</p><h3>The Traditional Approach:</h3><p>Using Confluent Cloud’s capabilities, one way to achieve this is by writing a Flink SQL query:</p><blockquote>SELECT *</blockquote><blockquote>FROM sample_data_orders</blockquote><blockquote>WHERE address.state = ‘State_94’;</blockquote><p>This works perfectly, but you need to know:</p><ol><li>The exact topic name (sample_data_orders).</li><li>The structure of the JSON message (that state is nested under address).</li><li>The correct Flink SQL syntax.</li></ol><h3>The Natural Language Approach with AI + MCP:</h3><p>This is where Cursor and MCP came into play. Cursor is an AI-powered code editor, and in this setup, it was enhanced with MCP. Think of MCP as a structured way for the AI agent within Cursor to discover and use available tools or APIs. The specific tools enabling interaction with Confluent Cloud, as shown in this example, are available in the<a href="https://github.com/confluentinc/mcp-confluent/"> <strong>Confluent MCP repository on GitHub</strong></a>.</p><p>Here’s the process I followed:</p><p><strong>Context Awareness (Schema):</strong> First, I needed the AI to understand the <em>structure</em> of my data. Confluent MCP provides a “tool” (found in the linked repository) for the AI to interact with the Schema Registry associated with my Kafka cluster. Asking to list all schemas allows the AI to fetch this structural information.</p><p><strong>Asking the Question:</strong> With the schema context established, I simply asked my question in natural language directly within Cursor’s chat interface:<br>list all orders whose state is State_94</p><figure><img alt="Asking the query in plain English within the Cursor AI chat." src="https://cdn-images-1.medium.com/max/1024/0*ROo4yACX3xRcCNfW" /></figure><p><strong>AI Translation to Flink SQL:</strong> Cursor’s AI, understanding my request and knowing the data schema, interpreted the natural language. It correctly identified the target topic, the filtering condition, and the required query language (Flink SQL). It then <em>generated</em> the precise Flink SQL statement.</p><figure><img alt="The AI translates the natural language query into the corresponding Flink SQL statement." src="https://cdn-images-1.medium.com/max/1023/0*CZ6rOnWWX_ntDuFF" /></figure><p><strong>Execution via MCP:</strong> The AI didn’t just generate the query; it recognized that another MCP tool (also available in the Confluent MCP repository) was available to <em>execute</em> Flink SQL statements against my Confluent Cloud environment. It invoked this tool, passing the generated SQL query.</p><p><strong>Getting the Results:</strong> The MCP tool executed the query against the Kafka topic via Confluent’s Flink SQL service. The results were passed back through MCP to the Cursor AI, which then presented them in a summarized, readable format, indicating 175 orders were found.</p><figure><img alt="The AI executes the query via MCP and presents the summarized results." src="https://cdn-images-1.medium.com/max/662/0*tYEoOIFXOUs7uH-p" /></figure><p><strong>Why is this Significant?</strong></p><p>This workflow demonstrates a powerful shift in how we can interact with complex data systems like Kafka:</p><ul><li><strong>Accessibility:</strong> Users don’t need to be Flink SQL experts to explore data.</li><li><strong>Speed:</strong> It dramatically reduces the time from question to insight.</li><li><strong>Reduced Friction:</strong> Lowers the barrier to entry for data exploration.</li><li><strong>Leveraging Existing Infrastructure:</strong> Seamlessly integrates with Confluent Cloud features.</li><li><strong>Extensibility:</strong> The MCP framework allows for adding more tools.</li></ul><p><strong>Conclusion:</strong></p><p>Combining AI assistants like Cursor with integration frameworks like MCP allows us to build intuitive interfaces over powerful backend systems. Translating natural language questions into executable queries like Flink SQL for Kafka unlocks data accessibility. For those interested in the technical implementation, the tools used here can be found in the<a href="https://github.com/confluentinc/mcp-confluent/"> <strong>Confluent MCP repository</strong></a>. It’s an exciting glimpse into a future where interacting with data is as simple as asking a question.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f45bff1385c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to quickly build a Kafka chatbot using Flink,GPT4 and Streamlit]]></title>
            <link>https://medium.com/@rahulbats/how-to-quickly-build-a-kafka-chatbot-using-flink-gpt4-and-streamlit-8014f06125f0?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8014f06125f0</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[flink]]></category>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Fri, 05 Apr 2024 22:27:47 GMT</pubDate>
            <atom:updated>2024-04-05T22:27:47.651Z</atom:updated>
            <content:encoded><![CDATA[<p>I frequently encounter questions from customers who want to perform quick lookups in their topic data, such as how to quickly obtain a specific record in Apache Kafka® or how many records were produced in the last hour. Flink SQL can do this and it is now <a href="https://docs.confluent.io/cloud/current/flink/index.html">GA</a> on Confluent Cloud. This can be very useful for a seasoned Flink/SQL user, but not everyone is familiar with Flink SQL query writing. Wouldn’t it be nice if there was a way to interpret your natural language questions into Flink SQL?</p><p>Some of the tools in the current GenAI landscape are mature enough to translate natural language text into SQL tasks. In this article, I will demonstrate how some quick python code can be used to develop a chat bot which will take your natural language questions and use <a href="https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo">gpt-4-turbo-preview</a> to convert it into Flink SQL and then use <a href="https://docs.confluent.io/cloud/current/api.html#tag/Statements-(sqlv1)">Confluent Cloud Flink API </a>to run this SQL and get back results and show it to the user.</p><p>For the purpose of this article, I chose to use OpenAI <a href="https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo">gpt-4-turbo-preview</a>, because in my tests it performed the best in interpreting a wide range of natural language questions. As you may know, GPT is closed source and it involves signing up for OpenAI’s <a href="https://openai.com/blog/openai-api">api key</a>. If you are not comfortable with this you could use open source foundational models like <a href="https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2">Mistral</a> or <a href="https://huggingface.co/meta-llama/Llama-2-7b">Llama</a> or fine tuned text-to-sql models like <a href="https://huggingface.co/defog/sqlcoder-7b-2">SQL coder</a>,<a href="https://huggingface.co/chatdb/natural-sql-7b"> natural sql </a>and finetune them with a Flink SQL dataset. However, fine tuning requires a large dataset for accuracy, so before you take it on, consider all the challenges involved.</p><h3>Building the chatbot</h3><p>To begin, let’s consider an orders topic with content shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g_EpbYF7bz8pv8pQ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/0*RYlM6AOgzLwzu1cz" /></figure><p>We want to build a chatbot where users can ask natural language questions on this topic. To begin with make sure you have signed up for Flink in Confluent Cloud. If you open your Flink SQL workspace you will automatically see the Flink table created for the <strong>order</strong> topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/0*B-XCICs9916k8o69" /></figure><p>To build the Chabot we will be using a very popular python tool called <a href="https://streamlit.io/">Streamlit</a> which allows you to quickly build chatbots like these, and also allows you to share them with the community. This is the community share link for this <a href="https://rahulbats-flink-chatbot-flink-jvioz6.streamlit.app/">Chatbot</a> and <a href="https://github.com/rahulbats/flink-chatbot">this</a> is the link to the code.</p><p>First, we develop a form which takes your OpenAI key and also the Flink environment details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FepF8auT5uktKe6k" /></figure><p>On submitting this form, the code needs to first run a query to list all tables:</p><pre>requests.post(getFlinkStatementsURL(),<br>json= {<br>&#39;name&#39;: &#39;show-tables&#39;,<br>&#39;organization_id&#39;: confluentOrg,<br>&#39;environment_id&#39;: confluentEnvironment,<br>&#39;spec&#39;: {<br>&#39;statement&#39;: &#39;show tables&#39;,<br>&#39;properties&#39;: {&#39;sql.current-database&#39;: confluentDatabase, &#39;sql.current-catalog&#39;: confluentCatalog},<br>&#39;compute_pool_id&#39;: confluentPool,<br>&#39;principal&#39;: confluentPrincipal,<br>&#39;stopped&#39;: False<br>}}, auth=(confluentApiKey, confluentApiSecret))</pre><p>And from the table list we loop through and run show create table to get the create statement for each table and join them together to get the entire schema.</p><pre>result = requests.post(getFlinkStatementsURL(),<br>json= {<br>&#39;name&#39;: &#39;show-create-&#39;+tableNameinURL,<br>&#39;organization_id&#39;: confluentOrg,<br>&#39;environment_id&#39;: confluentEnvironment,<br>&#39;spec&#39;: {<br>&#39;statement&#39;: f&#39;show create table `{table}`&#39;,<br>&#39;properties&#39;: {&#39;sql.current-database&#39;: confluentDatabase, &#39;sql.current-catalog&#39;: confluentCatalog},<br>&#39;compute_pool_id&#39;: confluentPool,<br>&#39;principal&#39;: confluentPrincipal,<br>&#39;stopped&#39;: False<br>}<br>}, auth=(confluentApiKey, confluentApiSecret))</pre><p>This can take a while to analyze and the screen looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XQGbxmwSrswec4xu" /></figure><p>After analyzing it looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/0*FqKB0ptE5yptvpDc" /></figure><p>Now we can use this schema to start asking questions to Chat GPT and get back the SQLs answers which we can fire on the Confluent Cloud Flink clusters to get back answers</p><p>For instance if we ask to count orders placed from dallas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WWn89gYJCrWPl2TJ" /></figure><p>In the code I have printed the SQL query we got back from GPT4 and also the results obtained from Confluent Cloud Flink. Note the bot was smart enough to understand that it has to look into order-&gt;customer-&gt;address-&gt;city. Also note this has to be continuously running, as unlike traditional databases, in streaming your counts continuously change. Refer to the code and the <a href="https://docs.confluent.io/cloud/current/api.html#tag/Statements-(sqlv1)">API documentation </a>on how to do this.</p><p>Below the user asks show distinct customer names in the order table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/0*Q9U8mnFS3GvDPbJj" /></figure><p>Here i asked to count orders created since yesterday</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*9IaTikA6ZzPTJORJ" /></figure><p>Again notice how the LLM did interpretation of yesterday to the query above. This query can be challenging to write for a person new to Flink SQL. Also notice how it uses a field called $rowtime. This field is a hidden field representing record creation time and it is not there in the schema.</p><p>So to achieve this we need to come up with clever ways to instruct Chat GPT in our prompt.</p><p>This is the prompt that I used:</p><pre>You are a specialized GPT trained to help generate Flink SQL queries from natural language questions.<br>You just generate the SQL and don&#39;t provide explanations so that you can use the output for further processing.<br>You are assuming create time is represented by a hidden field called $rowtime, which is of datatype TIMESTAMP_LTZ(3).<br>So if you want to compare it to a string you are sending , you will have to cast the string to TIMESTAMP_LTZ(3) using cast(timestamp TIMESTAMPSTRING as TIMESTAMP_LTZ(3)).<br>limit the query to 10 rows if the query does not have it.<br>Use flink&#39;s new windowing table valued functions to answer the question, and use lower case for all keywords.<br>Use exact case i gave in the query.<br>Use schema below to answer the question.<br>\n {schema}</pre><p>Although the above prompt is a little lengthy it takes care of all the edge cases and also instructs Chat GPT on the $rowtime variable.</p><p>Here we want to query order counts created since March 30th. You can see from the result it automatically figured out how to use the $rowtime field and cast</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/0*CyCcFZZ_ZRjHBpHL" /></figure><p>Now that we know how smart this thing is, let’s try to push it a little bit. I find the Windowing table-valued functions quite hard to write. For more information on what these are, and on how to use them refer to this <a href="https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-tvf/">page</a>. Now let’s ask our Chatbot to do these queries for us.</p><p>Here I asked calculate sum of quantities from order grouped by window start and end with tumbling window of 10 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/0*BoPw0u7EeyezYwip" /></figure><p>Here I asked to calculate sum of quantities from order grouped by window start and end with hoping window of 10 minutes with a slide of 5 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/0*HkrbQ1h_tSaKCfJO" /></figure><p>From this blog you can see how easy it is to write a chatbot to talk to your Kafka data in topics.</p><p>One issue is that however good the LLM gets, it might still make mistakes just like any other human. In my code i am sending the entire chat history of the current session, including the question user asked, using code like this</p><pre>query = st.session_state.llm.chat.completions.create(model=&quot;gpt-4-turbo-preview&quot;,messages=st.session_state.messages)</pre><p>This allows you to instruct the chatbot to fix the mistake it made, and correct it in its next response, as the LLM has historical context.</p><p>As mentioned before you can try this with the open source LLMs as well. Just download your desired model from Hugging face and serve it using the <a href="https://github.com/ollama/ollama">Ollama cli</a>. And then use the <a href="https://github.com/ollama/ollama-python">Ollama python client </a>to run the questions on the model running on your local machine. Keep in mind that any model having parameter count greater than 7 billion needs beefy GPUs, and the model will take several minutes to hours to answer your questions. Also from my testing they fall short, as the complexity of your questions increases. For example none of them could construct a query for Windowing table-valued functions. This probably can be addressed by proper fine tuning.</p><p>Incorporating a Chatbot like this in your organization’s ecosystem allows any one from top level managers to workers in the field, to search and analyze your streaming data. This empowers anyone in the organization, technical or non-technical, to contribute to your data in motion.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8014f06125f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI for Kafka part 2 (with LDAP/]]></title>
            <link>https://medium.com/@rahulbats/ui-for-kafka-part-2-with-ldap-f9ade38e7373?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9ade38e7373</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[sasl]]></category>
            <category><![CDATA[ldap]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Tue, 07 Jul 2020 18:52:49 GMT</pubDate>
            <atom:updated>2020-07-07T19:27:54.528Z</atom:updated>
            <content:encoded><![CDATA[<h3>UI for Kafka part 2 (with LDAP/AD)</h3><p>This is a continuation of an earlier <a href="https://medium.com/@rahulbats/ui-for-kafka-which-uses-sasl-accounts-be68c1e348c0">blog</a> on writing a UI for Kafka. In the <a href="https://medium.com/@rahulbats/ui-for-kafka-which-uses-sasl-accounts-be68c1e348c0">part 1 blog</a>, i described the <a href="https://github.com/rahulbats/kafka-web-ui">Kafka Web UI</a> we created which can use SASL accounts as login to connect to Kafka. This allows your organization to define ACLs, to allow users to view messages only inside a certain subset of topics. But most organizations want their users to login with LDAP/AD accounts and don’t want a SASL account to be shared by multiple users. In this part we will discuss how the <a href="https://github.com/rahulbats/kafka-web-ui">Kafka Web UI</a> handles this.</p><p>As mentioned in our earlier <a href="https://medium.com/@rahulbats/ui-for-kafka-which-uses-sasl-accounts-be68c1e348c0">blog</a> we are using SASL accounts as our logins by having them stored as a file or environment variables and then the user logins with these SASL accounts and they are verified against these store accounts. Once verified these are used to connect to the downstream Kafka server. The UI makes calls to the server using JWT tokens from the SASL account userId. You can then create ACLs to restrict the view permissions of a particular SASL userid. Now if we want to login through LDAP, first of all <a href="https://github.com/rahulbats/kafka-web-ui">Kafka Web UI</a> needs to allow LDAP logins. This can be done by enabling the LDAP settings mentioned <a href="https://github.com/rahulbats/kafka-web-ui#login-through-ldap">here</a>.</p><p>Now the user will be able to login using his organization’s LDAP account instead of SASL account. This allows Kafka admins to run a more secure Kafka, since they don’t have to share sensitive SASL accounts(username/passwords) with multiple users. But these LDAP accounts can not connect to Kafka on their own, as Kafka is running on a SASL mechanism (PLAIN/SCRAM). So the <a href="https://github.com/rahulbats/kafka-web-ui">Kafka Web UI</a> needs to translate the LDAP account into a SASL account.</p><p>It’s a bad idea to translate each LDAP user to a SASL account. LDAP users are under things called LDAP groups. We need to use the LDAP groups to do this translation. So the flow should look something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A44W9Kgx5asx1yBITyZd7w.png" /></figure><p>The above approach should work if you name your LDAP groups exactly the same as the SASL Userids. One thing to mention is that LDAP account retrieval is case insensitive. So you should have your SASL accounts all lower case.</p><p>This can work fine if a single user is always mapped to a single LDAP group. But problems will arise if a user is mapped to more than one group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J6BiP3tQSFXGh4Wz3sejSA.png" /><figcaption>User part of multiple groups</figcaption></figure><p>In this case Kafka UI will think user will belongs to Group A and show him only topic A, instead of all three topics.</p><p>To overcome this we have to follow following approach to list topics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EYzmULVWvMsCdQ7XN9orLA.png" /><figcaption>Topic Service with union on all SASL accounts</figcaption></figure><p>When the message service is called to list messages inside topic, we will again have to try to hit Kafka in loop for every SASL account (continue on TopicAuthorizationException) and break out of the loop if we get back messages.</p><p>With this <a href="https://github.com/rahulbats/kafka-web-ui">Kafka Web UI</a> can now allow employees in your organization to use their AD/LDAP logins to view messages inside Kafka. Kafka admins can restrict who can see what using ACLs set to SASL accounts, which exactly match these Group names(all lower case). The environment variables you need to do this are specified <a href="https://github.com/rahulbats/kafka-web-ui#login-through-ldap">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9ade38e7373" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI for Kafka which uses SASL accounts]]></title>
            <link>https://medium.com/@rahulbats/ui-for-kafka-which-uses-sasl-accounts-be68c1e348c0?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/be68c1e348c0</guid>
            <category><![CDATA[sasl]]></category>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[streaming]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Tue, 21 Jan 2020 16:01:06 GMT</pubDate>
            <atom:updated>2020-07-07T18:55:19.449Z</atom:updated>
            <content:encoded><![CDATA[<h3>UI for Kafka which uses SASL accounts (Part 1)</h3><p>As we all know Kafka is a fantastic tool, which you can use to do some transformative things in your organization. As you start using Kafka, everyone starts running it without security, but eventually they realize the need for security. For instance you may want to allow certain users to write to a subset of topics, but not every topic. Similarly you might want certain users to read only a certain set of topics and not every topic. Kafka traditionally implements this with SASL authentication and ACLs. So you create several <a href="https://docs.confluent.io/current/kafka/authentication_sasl/index.html">SASL accounts like so</a> and create <a href="https://docs.confluent.io/current/kafka/authorization.html">ACLs</a> for them. This is a great strategy and all the clients i work with, use this. The only problem i see with this, is that there is no User Interface to Kafka, which can use these SASL accounts. Imagine there was a User Interface which could accept the SASL accounts as logins and then display the topics and messages for that particular SASL account. That can solve a lot of issues many companies face when using Kafka. For instance they don’t want every developer to see all the messages in every topic, since some of these topics might hold confidential data. For this purpose i created the <a href="https://github.com/rahulbats/kafka-web-ui">Kafka Web UI tool</a> which i will be going over in this blog.</p><h3>Kafka Web UI walkthrough</h3><p>The main purpose of the Kafka Web UI is to allow SASL accounts as login. When you open the UI you will get a login screen where you will enter a SASL account userId, password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*goU-dW3XvSKEJhiCws7_fQ.png" /></figure><p>Once you login you will see topics which this SASL user is permitted to see. Refer <a href="https://docs.confluent.io/current/kafka/authorization.html#adding-acls">this</a> on how to use ACLs to restrict SASL account to view only certain topics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQC1hiapUFZub7FM7nvcwg.png" /></figure><p>Clock on any topic to expand it and you will see that partitions under this topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9jVotnFAztbxIltSHUjDLg.png" /></figure><p>Click on any partition and you will see the messages inside the partition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WZG1jaICTPl8jwoRDId0mw.png" /></figure><p>You can do a text search in the messages that are on the screen. To retrieve more messages on the screen increase the max messages from 100 to your desired number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*3xI4eRsCN8FrUs3pYeTPgA.gif" /></figure><h3>How to run Kafka Web UI ?</h3><p>Now that we have gone through what Kafka Web UI can do let’s go over on how to set it up. You can run it in two ways.</p><ul><li>You can build a jar from the <a href="https://github.com/rahulbats/kafka-web-ui">source</a> and then <a href="https://github.com/rahulbats/kafka-web-ui#run-as-standalone-java-application">run it</a> on a machine with java.</li><li>The other way is to <a href="https://github.com/rahulbats/kafka-web-ui#run-as-a-docker-container">run a docker container</a> using this <a href="https://hub.docker.com/repository/docker/rahulbats/kafka-web-ui">image</a>.</li></ul><p>Both the ways are explained in detail in the Github repo. They need a set of <a href="https://github.com/rahulbats/kafka-web-ui#list-of-environment-variables">environment variables</a> which is used by the container/jar to connect to the Kafka broker.</p><p>You can use this tool to view both JSON and AVRO messages. To view AVRO messages you will need to configure the schema registry URL details. Refer the <a href="https://github.com/rahulbats/kafka-web-ui#list-of-environment-variables">environment variables</a> to do so.</p><p>Please feel free to use it or improve it by collaborating using pull requests or reporting issues.</p><p><strong><em>In the </em></strong><a href="https://medium.com/@rahulbats/ui-for-kafka-part-2-with-ldap-f9ade38e7373?sk=fc29827b5ffd92ccb6d7840d9f807a9a"><strong><em>next part</em></strong></a><strong><em> of this blog we will talk about using LDAP/AD to login instead of direct SASL accounts.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be68c1e348c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup Kafka Multi Data Center replication on Kubernetes]]></title>
            <link>https://medium.com/@rahulbats/setup-kafka-multi-data-center-replication-on-kubernetes-172e7cb2311e?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/172e7cb2311e</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[multi-data-center]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[replication]]></category>
            <category><![CDATA[confluent]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Tue, 28 May 2019 04:37:58 GMT</pubDate>
            <atom:updated>2019-07-31T21:13:03.356Z</atom:updated>
            <content:encoded><![CDATA[<p>You have setup Apache Kafka to be the organization’s central nervous system. It is very important that you are prepared for an event of things going wrong. This strategy is called disaster recovery (DR) and if you are running Kafka for your mission critical apps, then its absolutely necessary to have it. In this blog i will explain how to setup a cluster of replicator containers on Kubernetes, to do this replication. The following diagram illustrates what we are trying to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*8eVpCKtyTC33--1oogXX3A.png" /><figcaption>Kafka replicator on Kubernetes</figcaption></figure><p>We will use Confluent replicator to do the replication. Confluent <a href="https://hub.docker.com/r/confluentinc/cp-enterprise-replicator-executable/">replicator</a> is a confluent supported plugin to replicate Kafka topics across data centers. This blog shows you how to use this app in Kubernetes.</p><h3><strong>Why Kubernetes ?</strong></h3><p>You can run the replicator in a normal machine or virtual machine if you wish. But you need to run replicator in multiple machines, which can act like a cluster and share the load. You want to quickly scale the cluster up or down based on the load (data coming into your Kafka topics). Also Kubernetes makes sure the replicator pods are always working. If something wrong happens in any pod, a new pod gets created by Kubernetes.</p><h3><strong>Lets get started — Setup a source and destination Kafka cluster</strong></h3><p>First let’s create a source and destination Kafka cluster. We will do this in Confluent cloud, but you can create it in any other way you prefer. For those of you who are new to Confluent cloud, it is a Confluent managed Kafka service. Instead of you having to setup and maintain a Kafka cluster, you let Confluent manage it on AWS , GCP or Azure. It’s a quick and most convenient way to use Kafka for your organization. Once you create a Kafka cluster on Confluent Cloud you can go to the Data in/out tab to create your credentials. Once you generate your credentials it will show you a screen like this for connecting to the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KC5e2xmkmd_-6WJhrY5s1A.png" /></figure><p>Create a source Kafka cluster and a destination Kafka cluster preferably in different regions. In the source Kafka cluster let’s create a topic which needs to be replicated. In this case i am replicating a topic called “meetups”. In the destination Kafka cluster lets create a topic called “meetups.replica”. This topic will be the destination topic which will be used by replicator to produce data to. We will use this to create the properties files we need in the next step.</p><h3><strong>First create the properties files</strong></h3><p>Read the confluent <a href="https://docs.confluent.io/current/multi-dc-replicator/replicator-executable.html#configure-producers-and-consumers-with-replicator-executable">documentation</a> on how to run the replicator executable. In short you will need 3 files producer.properties, consumer.properties and replication.properties. The consumer.properties has properties on how to connect to the source cluster. The producer.properties says how to connect to the destination cluster and replication.properties has topic and replication details.</p><p>Lets create a directory and call it replicator-properties.</p><h4>Inside this directory lets create a consumer.properies</h4><pre>bootstrap.servers=&lt;bootstrap.servers&gt;<br>ssl.endpoint.identification.algorithm=https<br>sasl.mechanism=PLAIN<br>request.timeout.ms=120000<br>retry.backoff.ms=500<br>retries=10<br>sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username=\”&lt;API_KEY&gt;\” password=\”&lt;API_SECRET&gt;\”;<br>security.protocol=SASL_SSL</pre><p>The above properties file is created with the details we got from Confluent Cloud source cluster.</p><h4>Lets create a producer.properties.</h4><pre>bootstrap.servers=&lt;bootstrap.servers&gt;<br>ssl.endpoint.identification.algorithm=https<br>sasl.mechanism=PLAIN<br>request.timeout.ms=120000<br>retry.backoff.ms=500<br>retries=10<br>sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username=\&quot;&lt;API_KEY&gt;\&quot; password=\&quot;&lt;API_SECRET&gt;\&quot;;<br>security.protocol=SASL_SSL</pre><p>The above properties file is created with the details we got from Confluent Cloud destination cluster.</p><h4>Lets create a replication.properties</h4><pre>topic.whitelist=meetups<br>topic.rename.format=${topic}.replica<br>name=c3-replicator<br>topic.create.backoff.ms=1000<br>topic.auto.create=false<br>topic.config.sync=false<br>offset.start=consumer</pre><p>In this properties file i am telling replicator to replicate a topic called “meetups” from the source Kafka cluster. For the destination topic i am telling it to use a pattern ${topic}.replica. So in this case the destination topic will be “meetups.replica”. You can choose whatever patter you like or just use the original name of the source topic with a pattern ${topic}.</p><h3>Add files to Kubernetes</h3><p>The files we created above needs to be uploaded into Kubernetes, so that it can be mounted into the containers we will create later. There are basically 2 ways to do this.</p><ul><li><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/">Config Maps </a>— Config maps stores files as it is and can be volume mounted into the container</li><li><a href="https://kubernetes.io/docs/concepts/configuration/secret/">Secrets</a> — Secrets are the same as Config Maps except they are stored opaquely and no one can read them.</li></ul><p>In this case we will have to use secrets as these properties file has sensitive information to connect to our Kafka cluster, which we don’t want to be for public view. Navigate to the parent folder of the replicator-properties directory we created earlier. Run this command there</p><pre>kubectl create secret generic replicator-secret-props --from-file=./replicator-properties</pre><p>After the above command executes we can run this command to list all secrets</p><pre>kubectl get secrets</pre><p>You should be able to see the “replicator-secret-props” in the list.</p><h3>Lets create the deployment yaml for Replicator cluster on Kubernetes</h3><p>First step is to create a deployment file which will deploy a cluster of replicator pods. Create a file called replicator-deployment.yml</p><pre>apiVersion: extensions/v1beta1<br>kind: Deployment<br>metadata:<br>  name: connect-cluster<br>spec:<br>  replicas: 2<br>  template:<br>    metadata:<br>      labels:<br>        app: replicator-app<br>    spec:<br>      containers:<br>        - name: confluent-replicator<br>          image: confluentinc/cp-enterprise-replicator-executable<br>          env:<br>            - name: CLUSTER_ID<br>              value: replicator-mdc<br>            - name: CLUSTER_THREADS<br>              value: &quot;2&quot;<br>          volumeMounts:<br>             - name: replicator-props-map<br>               mountPath: /etc/replicator/replication.properties<br>               subPath: replication.properties<br>             - name: replicator-props-map<br>               mountPath: /etc/replicator/consumer.properties<br>               subPath: consumer.properties<br>             - name: replicator-props-map<br>               mountPath: /etc/replicator/producer.properties<br>               subPath: producer.properties<br>      volumes:<br>         - name: replicator-props-map<br>           secret:<br>              secretName: &quot;replicator-secret-props&quot;<br>              defaultMode: 0666</pre><p>Let’s go over this file and what each section means.</p><ul><li>replicas — this tells Kuberenetes how many pods to create. In this case we will create 2. You can pick how many you like. The more the number of pods, the more the work gets shared among them.</li><li>image — this is the image we will deploy. Look at the Replicator executable image in <a href="https://hub.docker.com/r/confluentinc/cp-enterprise-replicator-executable/">Docker Hub </a>for the details about this image.</li><li>env — We are setting a clusterid environment variable to allow this pods to act as one cluster to share the work. Also we are telling replicator to run 2 threads so that they are spread among the 2 pods.</li><li>volumemounts — In this section we are adding the 3 files as volume mounts into the containers.</li><li>volumes — In this section we are telling Kubernetes to use the secret “replicator-secret-props”. The default mode 0666 gives processes read/write permissions into this directory.</li></ul><h3>Finally lets deploy the Replicator cluster</h3><p>Now that we are ready we can deploy the Replicator cluster using the following command</p><pre>kubectl apply -f replicator-deployment.yml</pre><p>After the command has run you can check the running pods using</p><pre>kubectl get pods</pre><p>You should see 2 pods running as per your deployment yaml</p><pre>NAME                               READY   STATUS    RESTARTS   AGE</pre><pre>connect-cluster-6c74fdb79d-bsxnn   1/1     Running   0          16s</pre><pre>connect-cluster-6c74fdb79d-h9ncp   1/1     Running   0          16s</pre><p>When you see both your pods running, open a terminal and start producing into the source kafka topic “meetups” in the source cluster. Your messages should show up in the destination Kafka cluster’s “meetups.replica” topic.</p><p>Thats it now you have <strong>Multi Data Center Replicator</strong> running on <strong>Kuberenetes</strong>. Now you never have to loose your sleep worrying about Kafka going down.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=172e7cb2311e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Pitfalls of Enterprise Programming]]></title>
            <link>https://medium.com/prolet-pro/pitf-b0b1e5456332?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0b1e5456332</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Fri, 06 Jul 2018 20:43:06 GMT</pubDate>
            <atom:updated>2018-07-06T21:03:57.305Z</atom:updated>
            <content:encoded><![CDATA[<p>The problems in todays enterprise software are numerous. Most projects do not get delivered and its a gigantic waste of human capacity and intellect. Instead of delivering great software which can make humanity better, enterprise software is stuck in petty politics and unnecessary processes and jargons. Imagine if we just streamlined software, how much the world economy would have benefited from the same.</p><p>In my experience the reasons for enterprise IT failing, are quite obvious and in our face. But no one seems to talk about it and like mindless zombies we come to work everyday, and we have reduced an innovative and creative profession such as programming, into a total waste of time. Just to talk a little bit about myself i have been a programmer for the last 15 years and i have seen a lot of corporations just throwing millions of hard earned money into IT projects which never go anywhere. So here are some of the very obvious pitfalls</p><h3>Agile is not very agile</h3><p>So every company wants to get into the agile bandwagon right now. They think that its some sort of a silver bullet, which can get rid of human stupidity. Let me elucidate this a little bit. Say you want to build a piece of software which needs to solve some business function in your organization. A really easy way to go about this is to just hire a bunch of good programmers to start. Then you need to have a meeting with them to explain what you need. Then you have to negotiate with them, the project delivery milestones. Now you have to leave it to them to figure out how they want to accomplish this. You can actively check with them for any updates, or you can be more passive and only check with them on delivery milestones. Your team can use modern communication channels like slack, hichat etc to relay information among each other and you. Quite simple isn&#39;t it ? But instead of that, we hire Scrum master, Product owners , QA testers, Architects and finally a few programmers. We force the programmers to endure endless meetings like standups, grooming, planning, retrospective, program increment planning etc where the decisions are always made by the non programmers and the programmers are just there as passive bystanders. So in a way you want to take away all the power from the programmer and trivialize and insult their profession and then expect them to write good software. Well duh !!!</p><p><strong><em>Solution — for god sake just hire developers in your teams. Scrum masters, PO, testers are redundant job functions and can be easily done collectively by the developers. Agile is not written in stone, let developers find out what works best for them, and not let managers shove outdated paradigms down their throat.</em></strong></p><h3>Corporate Hierarchy</h3><p>Enterprise software unlike startups have to provide their programmers a progression path in the enterprise food chain. So they come up with roles like tech leads, committers, principal architects, enterprise architects, directors and managers. This way upper management feels they can keep people happy without spending too much money. That programmer might leave for higher pay, so just make him an architect. The cost of this disastrous strategy though, is much higher. Let me explain why it is so. Most people are realizing that non programming architects are a bad idea, because the cost of their bad decisions are way higher as it impacts your entire organization, instead of the tiny little thing the developer is working on. And almost always architects make bad decisions, not because they are stupid, but just because they are way out of touch from real world programming. The moment the management promotes you to be a architect the expectation is that you stop coding and start pondering on the more erudite functions of your software landscape. And then come up with some harebrained ideas which your so called hoi polloi developers have to implement. End result- your architects have taken your entire development organization into a free ride to nowhere on a multi-billion dollar and time guzzling jalopy of a project which drives your company to bankruptcy. One more factor that is prevalent in some countries like the US is its peculiar immigration system. In US most programming workforce is visa holders and the managers, architects etc are citizen/green card holders. So the country’s immigration system is partly responsible for the disdain for programmers.</p><p><strong><em>Solution — Be an engineering driven company where being a developer is something to be proud of, and meaningless managerial roles are not required for people to be happy about themselves.</em></strong></p><h3>Microservices inside Corporate Hierarchy</h3><p>Oh we all love micro services don’t we ? Microservices like any other thing was supposed to make developers’ lives easier. It was supposed to give power back to the developers. From it came devops, developers can quickly build their own little toys and get it out for the business to see quickly and every one is happy and swell. Well but corporate hierarchy and job security was there to spoil that party. The sheer gall of developers who assume that can live in their small little cocoon of the nifty little micro service they built, is unthinkable. If this happens what would that architect , that director (who spends more time fishing than in office) and all other so called smarter people do ? Let me explain to you a dirty little secret of how micro services in the enterprise actually works. First they will say we promote micro services and probably let you build that node.js or springboot app that you wanted to build. Then they will say we need to build frameworks (be careful the moment some one utters this word) to centralize and control the work. So the developer is not allowed to use the nice little opensource library that he downloaded from github, and got everything running in one day. You have to use the enterprise framework instead, which does one tenth of what the opensource library does, and does it very poorly. Next the architect will fill this framework with as many hairbrained ideas that he can come up with, and go around talking about it till you ears start to bleed. Since no one can fire that architect, every one is made to reluctantly accept that framework and use it in their projects. So automatically project estimates and deadlines go out of the window, and so does your motivation. Now comes the next stage getting your software in a environment where the rest of the organization can see. Now comes devops. Devops as far as i understand meant developers who do operations functions too. So developers can write their code and get into the docker containers or chef environment etc. But corporations had an army of very incompetent linux admins who need to find their place in this new scheme of things. Earlier all they did was restart servers, and now you assign them the role of gatekeeper who sit there and lord over the developers. The way they do it is by controlling access. So you don’t get to do deploy anything but go through them and they feel important about themselves by pushing buttons.</p><p><strong><em>Solution- Embrace Micro services in form and spirit. Microservices are a great way to empower developers to quickly deliver without being bothered about bullshit peddlers in an enterprise setup. Do not let architects and their likes sell you frameworks (inhouse or purchased) unless its backed by an open source community. Devops is literally developers plus operations, do not build centralized monolithic devops teams whose sole purpose is to create hindrances and processes which don’t serve any function. Again let the developers decide how they want to distribute their software which they built.</em></strong></p><p>In conclusion i think we need a new manifesto. That manifesto should be much simpler than agile manifesto, and should contain some of the things which i mentioned. This is the need of the hour, to save this nice little thing which we all love and enjoy to do, Programming !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0b1e5456332" width="1" height="1" alt=""><hr><p><a href="https://medium.com/prolet-pro/pitf-b0b1e5456332">Common Pitfalls of Enterprise Programming</a> was originally published in <a href="https://medium.com/prolet-pro">Prolet.pro</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Final Chapter — Completing a Gig]]></title>
            <link>https://medium.com/prolet-pro/final-chapter-completing-a-gig-55b41cfb2d45?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/55b41cfb2d45</guid>
            <category><![CDATA[gigs]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[social-justice]]></category>
            <category><![CDATA[democracy]]></category>
            <category><![CDATA[project-management]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Sun, 25 Feb 2018 22:04:29 GMT</pubDate>
            <atom:updated>2018-02-25T22:04:29.742Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok till now we have covered a lot. Any one new to this blog, please refer to my <a href="https://medium.com/prolet-pro/can-we-achieve-true-democracy-using-blockchain-cdd092fe6df7">previous</a> blogs on what is <a href="http://prolet.pro/">Prolet</a> and how it works. Till now we have covered how we can democratically create teams, bid on teams etc.. Now say our team has worked hard and finished whatever was required from the Gig, and we are ready to submit and get paid. That again has to be done in spirit of <a href="http://prolet.pro/">Prolet</a>, democratically.</p><h4>Initiate a Completion Request</h4><p>Any one in the team at any time before the end date of the Gig, can create a completion request. He needs to go to the detail page of the project and click on “REQUEST COMPLETION”. He enters the URL of the project artifact, that the team has created and clicks on Submit. Again as this is on the blockchain he needs to pay a tiny transaction fees, through Metamask.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qf_NZ4LWCnPnq94LW2h3bQ.gif" /></figure><p>Now the other user in the team, when he logs in, he sees a pending vote under “<strong>Project completion requests</strong>”. Say now he approves the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0HhbaMS1Y80qZUz6Vknv8g.gif" /></figure><p>Once the transaction is successful, the Gig status will become “<strong>COMPLETION REPORTED</strong>” and will change color from green to blue. The Gig owner will also see 2 buttons “<strong>ACCEPT &amp; PAY</strong>” and “<strong>REJECT SOLUTION</strong>”. Lets say the Gig owner looks at the artifact link and likes the solution. He clicks on “<strong>ACCEPT &amp; PAY</strong>”. A popup opens up asking the Gig owner to rate the team. He gives them a great rating and clicks “COMPLETE”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2i7f0v0Q9q9IFaN5Dk7UfQ.gif" /></figure><p>Once the transaction goes through, project status will show “<strong>COMPLETED</strong>” and the color will change from blue to red. If the team members go to their profile they will see their rating has changed (rating is computed by calculating the average rating from all finished projects). Also this project will be listed as finished project. If he checks his funds, he should see 0.5 ether added(team reward was 1 ether divided between 2 team members).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*cTmdufsd3Cea39vrYPa-zw.png" /></figure><p>One important thing to note, that this rating becomes important, when the user applies for membership into other teams. The team members can look at this rating to decide if they would <strong>approve/deny the membership request</strong>. Also the Gig owner while <strong>deciding which bid to accept</strong>, can <strong>look at each team’s members ratings and skills</strong>, to decide how strong the team is. Therefore eventually this can be a <strong>better alternative to current interview processes to evaluate applicants</strong>.</p><h4>Conclusion</h4><p>In the last few blogs we went through the end to end lifecycle of a democratically managed project in <a href="http://prolet.pro/">Prolet</a>. Prolet is currently running on <a href="http://prolet.pro/">http://prolet.pro</a> and as i mentioned its in the Rinkeby test net. Its a very early proof of concept version and therefore has lots of bugs, but i am working on ironing them out as fast as possible. If you like what you see please don’t forgot to clap/follow etc. Please leave comments if you would like things to be altered, improved upon etc.</p><p>Also remember i always need help to sustain coding on these projects.</p><p>Support coding for prolate by donating</p><p>ether at <em>0x71901238CAbFBf6A1Ed73DBB6D9dF4fF7b2834c4 ,</em></p><p><em>BTC at </em>1Mt9qNAZbEkNLg7s5mxj7BuY49kmrG9LXn</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55b41cfb2d45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/prolet-pro/final-chapter-completing-a-gig-55b41cfb2d45">Final Chapter — Completing a Gig</a> was originally published in <a href="https://medium.com/prolet-pro">Prolet.pro</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Prolet works (in depth) — Part 2]]></title>
            <link>https://medium.com/prolet-pro/how-prolet-works-in-depth-part-2-222eabe5a980?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/222eabe5a980</guid>
            <category><![CDATA[gig-economy]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[gigs]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[democracy]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Sun, 25 Feb 2018 20:56:10 GMT</pubDate>
            <atom:updated>2018-02-25T22:15:38.235Z</atom:updated>
            <content:encoded><![CDATA[<p>So up until now we have described why we need democratic workplaces, how we can conceptually achieve it and started to describe an implementation of it through Prolet. In my previous blog i showed how teams are formed democratically. Now lets talk about Prolet from a customer perspective, the person with the money and needs a particular piece of work done.</p><h4>Login with a customer account</h4><p>The previous blog we used 2 addresses on the rinkeby network as Professionals. Now lets use another address as a customer (please note a same address can be used for both, and the user role is not saved into the blockchain).</p><h4>Switch role to customer</h4><p>Set the above address in Metamask and click on the login button. Then head over to the profile tab and switch role to <strong>Customer</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVhN9wLrefnHsYIqyxZ-JA.gif" /></figure><h4>Create a Gig</h4><p>Now head over to the Gigs tab. Click on the “ADD A NEW GIG” button. This opens up a form. Fill in the name, description, skills required to finish this project, end date and reward (the maximum Ether you are willing to pay). Click on Submit. On clicking on submit in Metamask, the reward money will be taken from your address and stored in the Smart Contract. Since the money is not getting transferred to a human, the Gig Owner does not have to worry about being cheated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0hbtP3XvWc1V8R3or8dQw.gif" /></figure><p>Once the transaction is successful you should see the new Gig inside the Gigs page. The status of the Gig is “<strong>not sarted</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4q5PqOOUGxMA8ncwyQWqzA.png" /></figure><h4>How Teams submit Bids on Gigs?</h4><p>So now that the gig is there, lets see how a team will submit a bid. Lets switch Metamask to a previous user, who was part of the team. He now logs into Prolet, he should see the Gig under <strong>Gigs -&gt; Other Gigs</strong>. Click on details to go to the details page. You can select the team from the “<strong>Bidding Team</strong>” pick list. Enter the “<strong>Asking price</strong>”(should be less or equal to the max reward the Gig is willing to pay). Click on <strong>Bid</strong> button. Remember this does not mean that the bid went through. This just created a request to be voted by the team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52W4UPCwYQrBaCYZ4TPYDw.gif" /></figure><p>Now if the other user in the team logs in, he should see the vote request for the bid. If this user approves, the bid will get accepted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*95g0A5picWnnldKY1pbJsQ.gif" /></figure><p>Once the transaction is successful the Gig owner will see the bid inside the gig detail page. He can choose to accept it. <strong>In this case the bid is with 1 ether, but the gig owner has parked 2 ether in the contract for this Gig. So the gig owner will be refunded 1 ether minus the transaction fees</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oA4YJGSBIkjZTp7Xg_ADaA.gif" /></figure><p>Once the transaction is successful the Gig work has now started. The panel color will change from orange to green, and the detail page will show status as “started”, assigned team as the teamId of the team whose bid was accepted, and the reward will switch from what the Gig owner initially promised to what the Bid asking price was.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4GcSBaLAliLKLqoioLA9rA.png" /></figure><h4>Conclusion</h4><p>So this is was how we can democratically initiate work. Notice the difference between traditional jobs. The team members don’t have to be colocated. The team does not need a manager, as team members vote on every decision. The monetary part of work is controlled through code (smart contract). Therefore the Gig owner can initiate Gigs with peace of mind without the fear of being cheated, and the same goes for the workers of the Gig.</p><p>In the <a href="https://medium.com/prolet-pro/final-chapter-completing-a-gig-55b41cfb2d45"><strong>next blog</strong></a>, we will talk about how to complete the Gig and how team members get paid.</p><p>Support coding for prolate by donating</p><p>ether at <em>0x71901238CAbFBf6A1Ed73DBB6D9dF4fF7b2834c4 ,</em></p><p><em>BTC at </em>1Mt9qNAZbEkNLg7s5mxj7BuY49kmrG9LXn</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=222eabe5a980" width="1" height="1" alt=""><hr><p><a href="https://medium.com/prolet-pro/how-prolet-works-in-depth-part-2-222eabe5a980">How Prolet works (in depth) — Part 2</a> was originally published in <a href="https://medium.com/prolet-pro">Prolet.pro</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Prolet works (in depth) — Part 1]]></title>
            <link>https://medium.com/prolet-pro/how-prolet-works-in-depth-part-1-bb3bfecac4dd?source=rss-24afceea655a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb3bfecac4dd</guid>
            <category><![CDATA[voting]]></category>
            <category><![CDATA[inequality]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[democracy]]></category>
            <dc:creator><![CDATA[Rahul Bhattacharya]]></dc:creator>
            <pubDate>Sun, 25 Feb 2018 16:30:50 GMT</pubDate>
            <atom:updated>2018-02-25T22:14:04.448Z</atom:updated>
            <content:encoded><![CDATA[<p>In my previous 2 blogs i talked about how conceptually we can use block chain to create democracy at work. Now i will go through in detail on how we do this at Prolet.</p><h3>Sign in into Prolet</h3><ul><li>Install <a href="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en"><strong>Metamask</strong></a> into your chrome browser</li><li>Switch to <strong>Rinkeby</strong> test net. (The smart contract is launched on Rinkeby testnet for now for testing, and not main network)</li><li>If you don’t have Rinkeby ether, you can get it using the <a href="https://faucet.rinkeby.io/"><strong>rinkeby faucet</strong></a>.</li><li>Once your address is funded, open your browser and navigate to <a href="http://prolet.pro./">http://prolet.pro.</a> Make sure your Metamask is pointed to Rinkeby, with a <strong>funded address</strong>.</li><li>Click on the <strong>LOGIN</strong> button to login with the address you are using in Metamask</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRUAWV7CiOc3v5dWAiplrw.gif" /></figure><ul><li>Once you are logged in, you have to decide whether you want to be a <strong>professional</strong>(people who work on gigs) or a <strong>customer</strong>(people who post gigs). You head to the <strong>PROFILE</strong> tab. Inside the tab you can switch over between the 2 roles. <strong>This does not cost ether as it is not saved on block chain.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kbKpNaDvc7Wzns3EO1WSsQ.gif" /></figure><ul><li>First lets see how a professional will use this. Lets create a team. Go to teams. Click on “<strong>ADD TEAM</strong>” button. Fill in the <strong>Name</strong> and <strong>Description</strong> and click on <strong>submit</strong>. Since this will be <strong>saved on blockchain</strong> you will have to pay a little bit of ether for the transaction fees. Click on <strong>submit in Metamask </strong>to submit the transaction. You can track the transaction on <a href="https://rinkeby.etherscan.io/"><strong>etherscan</strong></a>. Once the transaction is successful, head back to team tab and your team should be there.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PUQh1h1jQdu02bNNYSWbMw.gif" /></figure><ul><li>Now say some one else wants to join. Lets login using another address. If he goes to the “<strong>OTHER TEAMS</strong>” he sees the team we just created and clicks on “<strong>REQUEST MEMBERSHIP</strong>”. This will again cost a tiny bit of ether for transaction fees. After the transaction is successful, if you check back the team it should show “<strong>MEMBERSHIP REQUESTED</strong>”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*556H5Bnp8MUr7gEm78S6Vg.gif" /></figure><ul><li>If the team members log back in, they should see a <strong>pending vote to approve or deny inside his dashboard</strong>. If <strong>more than half of the team members approve, the user gets accepted into the team</strong>. In this case since there was only 1 member in the team and he approved the new member is now part of the team.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAwmnde3KOdQtSIE_x8L3g.gif" /></figure><ul><li>Now if you go to the team’s details you will see both the users as team members</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87DC-ecDh8queDh6V6Lhbw.png" /></figure><ul><li>In the above pic you can see the “<strong>KICKOUT</strong>” button, which will again initiate a request, which needs to be voted by all team members. Also the “<strong>Team Wall</strong>” is a place where team members can post messages. Since these will be added to the block chain, use it sparingly. Use a non blockchain communication mechanism like slack instead.</li></ul><h3>Conclusion</h3><p>In this blog we have covered how to create a decentralized team. Next we need to look at how to create Gigs. We will cover that in the <a href="https://medium.com/prolet-pro/how-prolet-works-in-depth-part-2-222eabe5a980"><strong>next blog</strong></a>.</p><p>Support coding for prolate by donating</p><p><em>Ether at</em> <em>0x71901238CAbFBf6A1Ed73DBB6D9dF4fF7b2834c4 ,</em></p><p><em>BTC at </em>1Mt9qNAZbEkNLg7s5mxj7BuY49kmrG9LXn</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb3bfecac4dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/prolet-pro/how-prolet-works-in-depth-part-1-bb3bfecac4dd">How Prolet works (in depth) — Part 1</a> was originally published in <a href="https://medium.com/prolet-pro">Prolet.pro</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>