<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lucas</title>
    <description>The latest articles on DEV Community by Lucas (@lucasviecelli).</description>
    <link>https://dev.to/lucasviecelli</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F372358%2F0d961262-dfeb-4f3a-a544-f156e3ff52a0.jpg</url>
      <title>DEV Community: Lucas</title>
      <link>https://dev.to/lucasviecelli</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lucasviecelli"/>
    <language>en</language>
    <item>
      <title>Exploring Apache Flink: A Deep Dive into the Game Sales fake project</title>
      <dc:creator>Lucas</dc:creator>
      <pubDate>Tue, 05 Mar 2024 01:16:49 +0000</pubDate>
      <link>https://dev.to/lucasviecelli/exploring-apache-flink-a-deep-dive-into-the-game-sales-fake-project-m94</link>
      <guid>https://dev.to/lucasviecelli/exploring-apache-flink-a-deep-dive-into-the-game-sales-fake-project-m94</guid>
      <description>&lt;p&gt;Apache Flink, a robust real-time data processing framework, has made a significant impact in the realm of continuous stream data analytics. This article aims to understand the core features of Apache Flink while also providing the playground project &lt;a href="https://github.com/lucasviecelli/apache-flink-agg-game-sales"&gt;Apache Flink Playground Game Sales&lt;/a&gt; that was used to reach some of these conclusions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Apache Flink: An Overview
&lt;/h2&gt;

&lt;p&gt;Apache Flink was designed to provide an efficient and scalable solution for real-time data processing. Supporting a wide range of applications, from data analytics to machine learning, Flink stands out due to its distinctive features that make it a popular choice in real-time data processing environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features of Apache Flink
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Event Time Processing:&lt;/strong&gt;&lt;br&gt;
Flink introduces the concept of event time processing, allowing the framework to understand and handle out-of-order events efficiently. This ensures accurate and reliable results even in scenarios with delayed data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stateful Computations:&lt;/strong&gt;&lt;br&gt;
The support for stateful computations in Flink allows processing events while maintaining state across time. This is particularly valuable for applications requiring context-aware processing, such as session windows or complex event processing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exactly-Once Semantics:&lt;/strong&gt;&lt;br&gt;
Flink guarantees exactly-once semantics for stateful operations, ensuring data consistency even in the face of failures. This feature is crucial for applications where precision and reliability are paramount.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rich Set of Operators and APIs:&lt;/strong&gt;&lt;br&gt;
Flink offers a rich set of operators and APIs for building complex data processing pipelines. Whether using low-level APIs for fine-grained control or high-level APIs for simplicity, Flink caters to various levels of expertise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dynamic Scaling:&lt;/strong&gt;&lt;br&gt;
Flink's architecture supports dynamic scaling, allowing users to adapt processing clusters to changing workloads. This ensures efficient resource utilization and the ability to handle varying data volumes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advanced Windowing and Time Handling:&lt;/strong&gt;&lt;br&gt;
Flink provides flexible windowing mechanisms, allowing developers to define windows based on processing time, event time, or a combination of both. This capability is fundamental for applications requiring time-based aggregations and analytics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connectivity with External Systems:&lt;/strong&gt;&lt;br&gt;
Integrating Flink into existing data ecosystems is a straightforward process, avoiding the need, for example, to perform aggregations separately and requiring a Kafka Connect to transmit data to another datasource. This is made possible by Flink's robust connectors with popular storage systems, databases, and messaging platforms, ensuring seamless interoperability and simplifying the creation of end-to-end data processing pipelines. It's crucial to take advantage of these features with caution, as when issues arise, debugging and troubleshooting can be more challenging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unified Batch and Stream Processing:&lt;/strong&gt;&lt;br&gt;
Flink blurs the line between batch and stream processing, offering a unified API for both. This allows developers to build applications that easy transition between batch and streaming paradigms, simplifying the development and maintenance of data processing workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Game Sales Project: A Practical Showcase
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/lucasviecelli/apache-flink-agg-game-sales"&gt;Apache Flink Playground Game Sales&lt;/a&gt; project serves as a practical showcase of Apache Flink's capabilities in real-world scenarios. By integrating Flink with Kafka and PostgreSQL, the project facilitates hands-on exploration of real-time data processing, event streaming, and database interactions within the Flink ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Workflow Highlights
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Setup and Initialization:&lt;/strong&gt;&lt;br&gt;
The project streamlines the setup process using Docker Compose, ensuring a seamless environment for testing and experimentation. You can easily clone the repository, follow the steps, and start exploring the features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Menu-Driven Interaction:&lt;/strong&gt;&lt;br&gt;
The project incorporates a user-friendly menu system that simplifies interaction with various components. Users can start Docker Compose, create Kafka topics, initialize PostgreSQL databases, and execute Flink tables, all through intuitive menu options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fake Data Generation:&lt;/strong&gt;&lt;br&gt;
A key aspect of the project is the ability to generate synthetic data using the provided Go producer script. This step allows users to simulate real-world scenarios by populating the Kafka topic with a customizable number of fake events.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Exploration and Analysis:&lt;/strong&gt;&lt;br&gt;
Once the environment is set up and data is generated, users can explore and analyze the results. The project offers menu options to showcase top hit game platforms and games stored in PostgreSQL, providing valuable insights into the processed data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases Explored
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Real-time Analytics:&lt;/strong&gt;&lt;br&gt;
The project demonstrates the application of Apache Flink in real-time analytics by show the top hit game platforms and games as they are processed and stored in PostgreSQL. The idea here is to have simple, aggregated data in the database and the heavy compression work is in Flink.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Exploration:&lt;/strong&gt;&lt;br&gt;
Users can explore the processed data both in Apache Flink and PostgreSQL, gaining a comprehensive understanding of the capabilities of the framework in handling real-time data streams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The combination of Apache Flink's powerful features and the practical implementation in the "Apache Flink Playground Game Sales" project exemplifies the versatility and effectiveness of Flink in real-time data processing scenarios. As businesses increasingly demand real-time insights, Apache Flink stands as a reliable solution, providing developers and organizations with the tools needed to harness the full potential of their data streams. The project serves as an insightful guide for those looking to explore and leverage the capabilities of Apache Flink in their own real-world applications.&lt;/p&gt;

&lt;p&gt;Although Apache Flink is undeniably powerful, leveraging its capabilities in large-scale environments can present challenges. While Flink excels in various use cases, it is not a silver bullet, and caution is advised when integrating it with diverse data sources and executing complex queries, especially when dealing with high-throughput data. Strategic considerations and thoughtful management of connections with external data sources become crucial for harnessing the full potential of Apache Flink in such environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It's essential have a robust governance and stringent requirements are fundamental for maintaining effective management control and ensuring the stability of Apache Flink&lt;/strong&gt;. It's not uncommon for new engineers to perceive Flink-SQL as a traditional database, leading them to attempt complex queries involving numerous joins and similar operations. However, it's crucial to recognize that stream processing, a core strength of Flink, is designed for rapid data processing and making decisions based on small, immediate data subsets. Adhering to these principles, Flink proves highly valuable in numerous data flow scenarios.&lt;/p&gt;

</description>
      <category>kafka</category>
      <category>programming</category>
      <category>data</category>
      <category>software</category>
    </item>
    <item>
      <title>Kafta is a modern non-JVM command line for managing Kafka clusters</title>
      <dc:creator>Lucas</dc:creator>
      <pubDate>Wed, 17 Aug 2022 21:48:00 +0000</pubDate>
      <link>https://dev.to/lucasviecelli/kafta-is-a-modern-non-jvm-command-line-for-managing-kafka-clusters-12hh</link>
      <guid>https://dev.to/lucasviecelli/kafta-is-a-modern-non-jvm-command-line-for-managing-kafka-clusters-12hh</guid>
      <description>&lt;p&gt;After several nights, weekends and late nights. Today we have the first stable release of &lt;a href="https://github.com/electric-saw/kafta"&gt;Kafta&lt;/a&gt;. This project was born a while ago with me and &lt;a class="mentioned-user" href="https://dev.to/snakeice"&gt;@snakeice&lt;/a&gt;. We spent several days frustrated using the native commands that come with Kafka.  &lt;/p&gt;

&lt;p&gt;Kafta was created by developers for developers. We feel the pain of maintaining a kafka cluster using the bash's provided by apache-kafka, it's confusing and the experience is miserable. To facilitate the adoption of the kafka, the kafta began to be born. Kafta is a golang project that is easy to install, easy to configure and simple to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Kafta is built on a structure of commands, arguments &amp;amp; flags. Kafta will always be interacting on one cluster at a time, the reason for this is not having to pass which cluster is in each command, as it is with most command lines for kafka.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To see all exists commands, run:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kafta 
Usage:
  kafta [command]

Available Commands:
  broker      broker management
  cluster     cluster management
  completion  Output shell completion code 
  config      Modify config files
  console     Console management
  consumer    Consumer group management
  help        Help about any command
  schema      Schema Registry management
  topic       Topics management
  version     Print the kafta version

Flags:
  --context string       The name of the kafkaconfig context to use
  -d, --debug                Debug mode
  -h, --help                 help for kafta
      --kafkaconfig string   Path to the kafkaconfig file to 

Use "kafta [command] --help" for more information about a command.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;To see all options exists relate to same command, run:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kafta topic
Topics management

Usage:
  kafta topic [command]

Available Commands:
  create      Create topics
  delete      Delete topics
  describe    Describe a topic
  list        List topics
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Simple commands
&lt;/h2&gt;

&lt;p&gt;Kafta is very similar to other cli's, it was made to avoid thinking "what is the syntax for this command". A great example is creating a topic. It's so simple, just run this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kafta topic create my-topic --rf 3 --partitions 10
Topic created
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! your topic is created.&lt;/p&gt;

&lt;p&gt;There are default values ​​for partition and replication factor, which is why it can only be used without specifying RF or partition. The topic will be created with RF=3 and partition=10. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kafta topic create my-topic
Topic created
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Installing
&lt;/h2&gt;

&lt;p&gt;Use go get to install the latest version. This command will install the Kafta executable along with the library and its dependencies:&lt;/p&gt;

&lt;p&gt;go &amp;lt; 1.18: &lt;code&gt;go get -u github.com/electric-saw/kafta&lt;/code&gt;&lt;br&gt;
go &amp;gt;= 1.18: &lt;code&gt;go install github.com/electric-saw/kafta/cmd/kafta@latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you prefer, just &lt;a href="https://github.com/electric-saw/kafta/releases"&gt;download&lt;/a&gt; the binary and run it on your machine, however and wherever you want.&lt;/p&gt;
&lt;h2&gt;
  
  
  Contexts &amp;amp; Config
&lt;/h2&gt;

&lt;p&gt;Kafta will create a config file in &lt;code&gt;~/.kafta/config&lt;/code&gt;. This yaml is used to support kafka multi-clusters and avoid passing all addresses every time.&lt;/p&gt;

&lt;p&gt;Each cluster in Kafta is called a context, Kafta's proposal is to be more than a simple Kafka manager, thinking about managing schema-registry, connect and other parts of a Kafka environment, we call this group a context.&lt;/p&gt;

&lt;p&gt;To set up a new context, create a new config via Kafta, you'll need to provide some information, don't worry, it's all in terminal, you don't need to edit any XML \o/&lt;/p&gt;

&lt;p&gt;Follow the example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kafta config set-context production
Bootstrap servers: b-1.mydomain:9092,b-2.mydomain:9092,b-3.mydomain:9092
Schema registry: https://schema-registry.com
Use SASL: y
SASL Algorithm: sha512
User: myuser
✔ Password: ******
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To list the contexts, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kafta config get-contexts
+---------------+---------------------------+-----------------------------+------+---------+
| NAME          | CLUSTER                   | SCHEMA REGISTRY             | KSQL | CURRENT |
+---------------+---------------------------+-----------------------------+------+---------+
| dev           | b-1.mydomain:9092         | https://schema-registry.com |      | true    |
| production    | b-3.productiondomain:9092 | https://schema-registry.com |      | false   |
+---------------+---------------------------+-----------------------------+------+---------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This part is a differential of Kafta. It is designed for environments with many clusters and it is essential to be easy to move from one cluster to another. To change the current cluster, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kafta config use-context production
Switched to context "production".
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Others commands
&lt;/h2&gt;

&lt;p&gt;Kafta has several commands and you can find an example of them in the project's &lt;a href="https://github.com/electric-saw/kafta"&gt;README&lt;/a&gt;. Some commands it has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consumer Groups&lt;/li&gt;
&lt;li&gt;Schema Registry - Partial support&lt;/li&gt;
&lt;li&gt;Consumer/Producer - Thanks &lt;a href="https://github.com/vfolgosa"&gt;Vinicius Folgosa&lt;/a&gt; for this contribution&lt;/li&gt;
&lt;li&gt;Broker&lt;/li&gt;
&lt;li&gt;Cluster configs&lt;/li&gt;
&lt;li&gt;Topics&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Contribution
&lt;/h2&gt;

&lt;p&gt;Kafta is very new and we have many opportunities to change and create many things, if you are interested in making a feature, please open a new issue and start a conversation with us. If you don't have time for that, just share the project and click on the star if you liked it ;)&lt;/p&gt;

</description>
      <category>kafka</category>
      <category>go</category>
      <category>microservices</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
