Apache Kafka Word Count – Java No.44

How to count the words in topic by Java is shown. ▼1. Steps of counting words in a topic by Java ▼2. Prerequisites 2-1. Installing an Apache Kafka cluster Install Apache Kafka 4 nodes No.42 2-2. Installing IntelliJ IDEA Install IntelliJ IDEA on Ubuntu No.43 2-3. Installing Apache Maven Maven – Download Apache Maven 2-4. Setting parameters of $KAFKABROKERS and $KAFKAZOOKEEPER 2-5. Creating the topic for both input and output ▼3. Counting words in a topic by Java 3-1. Creating a project of IntelliJ IDEA Creating a new project 3-2. Confirming the version 1.8 of JDK is used 3-3. Putting the following information while creating a project 3-4. Updating pom.xml … Continue reading “Apache Kafka Word Count – Java No.44”

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. ▼1. What is enable.auto.commit property? Setting enable.auto.commit means that offsets are committed automatically. if it is false, committing offset is needed in producer. KafkaConsumer (clients 0.9.0.1 API) (apache.org) ”Manual Offset Control” ▼2. Prerequisites ▼3. Reproducing duplicate messages in Consumer Setting Auto Commit to false and adding commit offset in Consumer are usually executed to read messages in Java. for the purpose of reproducing duplicate messages, I commented out commitSync() in this case. 3-1. Deploying Consumer Java application Setting enable.auto.commit to false. 3-2. Runing Producer and write 5 messages in a topic Apache Kafka – Develop … 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. ▼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 Quickstart: Install SQL Server and create a database on Ubuntu 2-2. Installing Microsoft JDBC Driver 8.2 for SQL Server Installing Microsoft JDBC Driver 8.2 for SQL Server (tar.gz) from Release notes for the Microsoft JDBC Driver for SQL Server Unzip tar –zxvf … 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. ▼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 Ubuntu Enable auto-import on IntelliJ IDEA No.13 2-3. Creating sample data Java – Create Database on Azure Cosmos DB (SQL API) Database No.14 ▼3. Java code to retrieve data on Cosmos DB (SQL API) 3-1. Creating Java code to find item Update the following parameters according to the setting on your environment … 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. ▼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. ▼2. Prerequisites 2-1. Installing Java 8 JDK Azul Zulu OpenJDK Java 8 (LTS) is supportable on Azure Service. steps of installation are shown in this document. Download Azul Zulu Builds of OpenJDK | Azul 2-2. Free trial Azure account for Azure Blob Storage Azure free account FAQ 2-3. Connecting to Azure Blob Storage using Azure Storage Explorer Creating Container and putting the file … 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. ▼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 subscription. https://azure.microsoft.com/ja-jp/try/cosmosdb/ 2-2. Enable Maven auto-import in IntelliJ IDEA on Ubuntu Enable auto-import on IntelliJ IDEA No.13 ▼3. Creating Database , Container and Data on Cosmos DB (SQL API) の Database, Container by Java 3-1. Java Coding These parameters should be changed according to your setting on your environment. Family class is used to insert … Continue reading “Java – Create Database on Azure Cosmos DB (SQL API) No.14”

Java – Delete Data on Azure Cosmos DB (SQL API) No.18

How to delete data on Azure Cosmos DB SQL API is written in this blog. ▼1. Delete data on Azure Cosmos DB (SQL API) Multiple Items in container on Azure Cosmos DB (SQL API) will be deleted using CosmosContainer.<T>deleteItem of Java. ▼2. Prerequisites 2-1. Free trial Cosmos DB account is available without subscription. https://azure.microsoft.com/ja-jp/try/cosmosdb/ 2-2. Enable Maven auto-import in IntelliJ IDEA on Ubuntu Enable auto-import on IntelliJ IDEA No.13 2-3.  Using Azure Cosmos DB Java SDK v4 4.8.0 Adding dependency of a Cosmos DB library in pom.xml Azure Cosmos DB Java SDK v4 for Core (SQL) API: release notes and resources 2-4. Creating Database and container Java – Create Database … Continue reading “Java – Delete Data on Azure Cosmos DB (SQL API) No.18”

Java – Connection String of Microsoft JDBC Driver for SQL Server No.7

I would like to share the detail of connection string of JDBC Driver for SQL Server in this blog. ▼1. Connection String of Microsoft JDBC Driver for SQL Server Connection String contains login timeout, socket timeout,query timeout, query timeout, authentication way and application name etc. ▼2. Example for the connection string of JDBC Driver for SQL Server We can avoid intermittent connection issue by implementing timeout, retry and interval of retry etc. This is an example for the connection string of Microsoft JDBC Driver for SQL Server. ▼3. Reference That’s all. Have a nice day ahead !!!

Enable auto-import on IntelliJ IDEA No.13

I would like to show how to enable auto-import on IntelliJ IDEA to load libraries automatically. ▼1. Setting to load the relevant libraries automatically 1-1. Enable Maven auto-import on IntelliJ IDEA We can find this icon from View -> Tool Windows -> Maven menu as blow. And then, we can choose “Enable auto-reload after any changes” after clicking “Toggle Auto Reload Mode”. 1.2. Check if you could confirm downloaded libraries after this settings After you add the following dependencies in Pom.xml and save pom.xml, you can find downloaded libraries from File -> Project Structure -> Project Settings -> Libraries I checked above setting on the following IntelliJ IDEA version before. IntelliJ … Continue reading “Enable auto-import on IntelliJ IDEA No.13”

Java – Save the results of select query on SQL Server into Azure Blob Storage No.75

I will show Java code that save results of select query on SQL Server into Azure Blob Storage. ▼1. Copy data on SQL Server into Azure Blob Storage Azure Data Factory (ADF) is a good and easy way to copy data on SQL Server into Azure Blob Storage. please refer to this document. in this blog, I will show Java code to do it instead of ADF. Ref: Copy and transform data to and from SQL Server by using Azure Data Factory or Azure Synapse Analytics ▼2. Prerequisites We execute select query on SQL Server for Ubuntu. 2-1. Installation of SQL Server on Ubuntu Ref: Quickstart: Install SQL Server and … Continue reading “Java – Save the results of select query on SQL Server into Azure Blob Storage No.75”