Apache Kafka – Develop Producer Java application No.66

How to develop Producer application by Java on Visual Studio Code is shown in this blog. Contents ▼1. Apache Kafka ▼2. Prerequisites▼3. Develop Producer Java application3-1. Make a directoryMake a directory to develop an application.3-2. Create a project using Apache Maven3-3. Remove the App.java and AppTest.java files3-4. Update pom.xml file3-5. Develop Producer application3-6. Execute Producer application3-7. Retrieve the generated data▼4. Reference▼1. Apache Kafka Ref: Apache Kafka ▼2. Prerequisites Install Apache Kafka 4 nodes No.42 Apache Kafka Word Count – Java No.44“2-3. Installing Apache Maven” ▼3. Develop Producer Java application This producer Java application write events from 1 to 100 into a topic. 3-1. Make a directoryMake a directory to develop … Continue reading “Apache Kafka – Develop Producer Java application No.66”

Java – Visual Studio Code on Ubuntu No.24

In this blog, How to run Java on Visual Studio Code on Ubuntu is shown. Contents ▼1. Run Java using Visual Studio Code on Ubuntu▼2. Prerequisites2-1.Install Ubuntu Ubuntu 20.04.5 LTS2-2. Setup Visual Studio Code2-3. Install Java Extension Pack2-4. Install JDK (OpenJDK 15)2-5. Set Environment variables for java.configuration.runtimes and java.home▼3. Show Hello World by Java3-1. Create Folder “JavaTest” and Hello.java file3-2. Press F5 key on VS Code or Click Run Java3-3. Create Jar file and run this jar3-4. Run the generated jar file in the terminal▼1. Run Java using Visual Studio Code on Ubuntu Visual Studio Code is the developer tool provided by Microsoft. Visual Studio Code works on both Windows … Continue reading “Java – Visual Studio Code on Ubuntu No.24”

Install IntelliJ IDEA on Ubuntu No.43

How to install IntelliJ IDEA on Ubuntu is shown in this blog. Contents ▼1. What is IntelliJ IDEA?▼2. Installing IntelliJ IDEA2-1. Download IntelliJ IDEA Community Edition2-2. Unzip downloaded IntelliJ IDEA Community Edition2-3. Run idea.sh to start IntelliJ IDEA2-4. Install Java 8 JDK▼3. Create Java code to show “Hello World”3-1. Click New Project to create a new project3-2. Confirm JDK version 1.8 version 1.8.0_312 after choosing Java3-3. Click Next and set Project Name (e.g) JavaHelloWorld and Finish it3-4. Under src folder, click New -> Java Class3-5. Set file name (e.g) Helloworld and double click Class3-6. Write a code in Helloworld.java as below3-7. Click “Build Project” in the pull-down menu “Build” to … Continue reading “Install IntelliJ IDEA on Ubuntu No.43”

Apache Kafka Word Count – Java No.44

How to count the words in topic by Java is shown. Contents ▼1. Steps of counting words in a topic by Java▼2. Prerequisites2-1. Installing an Apache Kafka cluster2-2. Installing IntelliJ IDEA2-3. Installing Apache Maven2-4. Setting parameters of $KAFKABROKERS and $KAFKAZOOKEEPER2-5. Creating the topic for both input and output▼3. Counting words in a topic by Java3-1. Creating a project of IntelliJ IDEA3-2. Confirming the version 1.8 of JDK is used3-3. Putting the following information while creating a project3-5. Creating log4j.properties file in src folder under main -> resources and then adding below.3-6. Creating WordCountStream.java in src folder under main -> java3-7. Writing below in WordCountStream .java3-8. Adding parameters3-9. Building Project3-10. Starting … Continue reading “Apache Kafka Word Count – Java No.44”

Install Apache Kafka 4 nodes No.42

How to install Apache Kafka 4 nodes is shown here. 4 ubuntu nodes are used for Apache Kafka. Contents ▼1. What is Apache Kafka?▼2. Installing Apache Kafka with 4 nodes2-1. Preparing for 4 Ubuntu 20.04.01 LTS x64 nodes2-2. Updating hosts file on 4 nodes2-3. Installing Java 8 JDK on 4 nodes2-4. Installing Apache Kafka on 4 nodes2-5. Updating environment variables on 4 nodes2-6. Only on Zookeeper node, zookeeper.properties is set.2-7. Starting Zookeeper2-8. Updating rc.local due to start of Zookeeper automatically when OS is started2-9. Configuring Kafka Brokers2-10. Updating rc.local each Brokers. the steps are the same as ones above 2-8.▼3. Creating Topic, writing and read data▼4. Reference▼1. What is Apache … Continue reading “Install Apache Kafka 4 nodes No.42”

Apache Kafka – Consumer Java – Duplicate Messages No.78

In this blog, Duplicate messages in Consumer are shown using Java with false of enable.auto.commit property. Contents ▼1. What is enable.auto.commit property?▼2. Prerequisites▼3. Reproducing duplicate messages in Consumer3-1. Deploying Consumer Java application3-2. Runing Producer and write 5 messages in a topic3-3. Commenting out consumer.commitSync(map) in Consumer of 3.13-4. Running the consumer which was updated in 3.3 to get messages.3-5. Finding duplicate messagesRe-running the consumer which was updated in 3.3 caused the duplicate messages.3-6. Removing the commented-out line in 3-3 and re-running this consumerWe could not find the duplicate messages.5 messages were committed.▼4. Reference▼1. What is enable.auto.commit property? Setting enable.auto.commit means that offsets are committed automatically. if it is false, committing … Continue reading “Apache Kafka – Consumer Java – Duplicate Messages No.78”

Java – Connect to SQL Server on Ubuntu No.5

In this blog, how to connect to SQL Server on Ubuntu using Java is shown. Contents ▼1. What is SQL Server on Ubuntu▼2. How to connect to SQL Server on Ubuntu2-1. Installing SQL Server on Ubuntu2-2. Installing Microsoft JDBC Driver 8.2 for SQL Server2-3. Connection String of JDBC Driver for SQL Server2-4. Output of this code▼3. Reference▼1. What is SQL Server on Ubuntu SQL Server is Relational Database (RDB) provided by Microsoft. SQL Server works on both Windows and Linux. we can use free trial version which is called as “Express Edition” within 180 days. ▼2. How to connect to SQL Server on Ubuntu 2-1. Installing SQL Server on Ubuntu … Continue reading “Java – Connect to SQL Server on Ubuntu No.5”

Java -Retrieve data on Azure Cosmos DB (SQL API) No.15

In this blog, how to retrieve data on Azure Cosmos DB is shown. Contents ▼1. Retrieve Data on Azure Cosmos DB (SQL API) ▼2. Prerequisites2-1. Free trial Cosmos DB account is available without subscription.2-2. Enabling Maven auto-import in IntelliJ IDEA on Ubuntu2-3. Creating sample data▼3. Java code to retrieve data on Cosmos DB (SQL API)3-1. Creating Java code to find item3-2. The result of executing the query▼4. Reference▼1. Retrieve Data on Azure Cosmos DB (SQL API)  Using steam() and iterableByPage() in CosmosPagedIterable<T> class of com.azure.cosmos.util library, We can retrieve data on Cosmos DB. ▼2. Prerequisites 2-1. Free trial Cosmos DB account is available without subscription. https://azure.microsoft.com/ja-jp/try/cosmosdb/ 2-2. Enabling Maven auto-import in IntelliJ IDEA on … Continue reading “Java -Retrieve data on Azure Cosmos DB (SQL API) No.15”

Java – Download files from Azure Blob Storage No.27

In this blog, How to download files from Azure Blob Storage using Java is shown. Contents ▼1. List file names and download files from Azure Blob Storage▼2. Prerequisites2-1. Installing Java 8 JDK2-2. Free trial Azure account for Azure Blob Storage2-3. Connecting to Azure Blob Storage using Azure Storage Explorer ▼3. List files and download these files from Azure Blob Storage3-1. Starting IntelliJ IDEA and confirming JDK version3-2. Updating pom.xml for operations of Azure Blob Storage3-3. Creating Java Code▼4. Reference▼1. List file names and download files from Azure Blob Storage Using IntelliJ IDEA 2021.1.2 (Community Edition) on Ubuntu , Java application lists files on Azure Blob Storage and downloads these files. … Continue reading “Java – Download files from Azure Blob Storage No.27”

Java – Create Database on Azure Cosmos DB (SQL API) No.14

In this blog, how to create database on Azure Cosmos DB (SQL API) using Java is shown. Contents ▼1. Some kinds of Azure Cosmos DB▼2. Prerequisites2-1. Free trial Cosmos DB account is available without subscription.2-2. Enable Maven auto-import in IntelliJ IDEA on Ubuntu▼3. Creating Database , Container and Data on Cosmos DB (SQL API) の Database, Container by Java3-1. Java Coding3-2. A part of Results3-3. Azure Portal of Cosmos DB shows data▼4. Preference▼1. Some kinds of Azure Cosmos DB Azure Cosmos DB is NoSQL Database. there are some kinds of API below. Choose an API in Azure Cosmos DB ▼2. Prerequisites 2-1. Free trial Cosmos DB account is available without … Continue reading “Java – Create Database on Azure Cosmos DB (SQL API) No.14”