Posts

Showing posts from August, 2021

Spring Kafka - How to use ReplyingKafkaTemplate send and reply synchronously

Image
Microservice Spring with Apache Kafka Today, I want to share how to use Kafka. It's quite interesting once you get the hang of it, and I hope my explanation will make it a bit easier for you. So, Kafka is primarily known as an asynchronous messaging queuing system. This means it allows different parts of your application to communicate with each other without waiting for immediate responses. However, there are times when you might need a more immediate reply from another service in your project. Luckily, Kafka can handle this too. Here’s how it works: The client side sends a message to the server side via Kafka. This message includes a special identifier in the Kafka header request, known as KafkaHeaders.CORRELATION_ID, along with a topic where the server should respond. The server, after processing the request, sends a message back to the same topic with the same correlation ID. This way, the client knows that the message is a response to its initial request and can act accordingl

Start small! You don’t have to solve world most difficult problem

Image
Start up meeting - Image by StartupStockPhotos from Pixabay You don’t have to create new business or solve the world's most difficult problem. You can just start a small doable business by following other businesses that already exist, as long as you have better product, packaging and marketing. People are too ambitious and think too far, it’s okay if you are Elon Musk, but if you just some random guy creating your own business, although it is possible to compete in space race, its chance is very slow compared to already exist doable business that you can just start So, start small, don’t overthink things. Only when your capital is significantly larger, only then you can start to think about expanding your business. Most businesses will fail before 1 year, so be careful, you have to manage your resources carefully. I read the book Atomic Habits, which can be summarized the following: Atomic Habits by James clear is a definitive guide for breaking bad behaviors, showing you how sma

5 Advices About Writing A Tech Blog For Beginner

Image
Blogger with laptop - Image by Peter Olexa from Pixabay Today’s is not going to be a technical tutorial about how to do stuff in some programming language or fixing some bug in some programming technique. It’s just my overall view about blogging without any preparation or research, it’s purely written straight from the document editor. As I am now a self-proclaimed tech blogger, because I feel I have written enough articles to have myself categorized as a blogger. I will be giving some advice about writing a tech blog, but this is for beginners. So, if you are not a beginner, maybe this is not the right article for you. Consistency Writing a blog is not easy, in fact it is very hard that every beginner will leave their blog untouched after a few tries writing less than 20 posts. For me the hardest part of writing a tech blog, or any other niche blog is the consistency, because we don’t always have perfect time, or perfect mood to develop a written article. To be consistent writing on

Better Understanding of ACID Principle In SQL Database

Image
ACID principle in SQL database ACID  is a set of principles whose acronym is Atomicity, Consistency, isolation and durability. As any other principle, it’s done by the developer or database admin or available feature on the database system of choice (MySQL, Postgres, SQL server). So as a developer or data admin you must know this principle in order to design and develop a database system for your project. Dealing with database transactions that have many queries in it should be handled following the ACID principle. When a set of queries are executed ACID prevents disaster in your data because something that is partially error in the middle of transaction can lead into data inconsistency. Because the app query expects all the query should be completed with no interruption, sometimes your database depends on other data. So here’s what ACID principles acronym are: Atomicity All queries in a transaction are treated as a single thing, if one query fails, the whole thing shouldn’t change any

Some Common Java Developer Interview Questions In 2021 Onward

Image
Job Interview - Image by Sue Styles from Pixabay If you are a software developer currently looking for a job, these are some common questions that the interviewers usually ask you. So, you better prepare. The question in the interview process will range from basic to technical questions. The basic questions will assess your experience in your previous job. If you are just a fresh graduate, you just have to tell them about the internship and your contribution. If you are already working in a company, again the principle to answer all the questions is the same, just share your contribution on the team of your company that you work before. In my experiences applying for a software developer job, there’s not going to be tricky questions actually, it rarely happens. Tell me about yourself? This question is simply asking your experiences in the software development industry, just it, nothing else. To answer this question, you need to tell in detail what’s So as relax as you can, tell the in

How to start develop Spring Boot application from Notepad

Image
While writing our codes in Java is easier done using specialized Java IDE (integration development environment) like Eclipse, VS code, IntelliJ, there’s actually no requirement to make your java application. You can just write the code using any tools. The advantage of writing codes in a simple editor like notepad is the lightness of the program, when writing codes in IDE it just feels sluggish when we are typing on it. Because in Notepad, you won’t be given any code suggestions, like method, variable, class etc, so you are typing faster. It can be cumbersome for new developers writing java code in a simple editor, but it is worth a try. So, let’s do it. 1. Install notepad++ We are not going to use the default windows notepad, it’s too ancient to do basically anything, so let’ s just give you the improved version of notepad, the notepad++. You can download from the web official download page here https://notepad-plus-plus.org/downloads/ . 2. Create spring boot skeleton app Go to the pa

What's the advantages of SOLID principle in OOP Java

Image
SOLID Principle In OOP Java As is our nature of laziness, we tend to write codes as if we don’t look for future potential disasters. As long as the codes work, it will just work fine. And I even recommend that if you are just beginner coders, you shouldn't care much about what principles you should use to write code. The first step of becoming a developer is just writing lots of code, no need for structure, or anything else, the only thing that matters is that the code works and returns output as it expected. In other words, you need to master the code's syntax, setup, debug, the environment, etc. As you gain many experiences over the years as a software developer, then you will have the sense to write better code, at this point, you start to look at design principles, design patterns etc. The Advantages of the SOLID Principle? In object oriented programming (OOP), we must know about the SOLID principle on writing better codes. But why should we use SOLID principles? - The Soli

How to reverse string in Java without built in library

Image
Reversing string in java is available via StringBuilder class, we can use stringBuilder.reverse(), then it magically reverses the string. But like an interview task for a Java developer job, sometimes the interviewer wants you to test your algorithm ability. So we have to do it manually, but don't worry it’s not that hard to reverse a string in Java. The thing that you need to do to reverse the string is basically just split the string into arrays of characters, and then loop all those characters through the array, and combine all the array but from the back. And This is simple java code not using Java built in library that you can just copy paste for reverse a string in Java. And here’s the comparison if you want to use String builder, it’s much cleaner and if you want to do it in real life, it’s much better using this way. Java is a magical language, it’s general purpose higher level language support for developing scalable, from personal to enterprise application, with lots

Java error Compilation failure Source option 5 is no longer supported

Image
Java and Maven - Packaging Manager This is a very common error for a beginner java for the first-time using maven. When you are compiling your Java application using Maven dependency management version 3.6. The following error will occur. - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project java-test: Compilation failure: Compilation failure: - Source option 5 is no longer supported. Use 6 or later. - Target option 1.5 is no longer supported. Use 1.6 or later. The solution is pretty simple, you just have to make sure you are using Java version 6 or higher. Then place this configuration in your pom xml.     <properties>         <maven.compiler.target>1.8</maven.compiler.target>         <maven.compiler.source>1.8</maven.compiler.source>     </properties> Now you can execute this following maven command on your project application, using maven commands to package your project into a jar like th

Intellij Lombok Run Error Method Not Found

Image
Java Maven Project Lombok Intellij This kind of error happens to me recently when I am working with microservices Spring Boot   Java application. When I use git, I usually gitignore the “.idea” configuration so when I switch between different branches meanwhile the “.idea” doesn’t change because it is being ignored, then the IntelliJ does not configure the project correctly. The solution is simply by removing the “.idea” folder, the “.iml”, IntelliJ project configuration. And reopen the project from IntelliJ . And the “target” folder, which is your java maven project build folder, some sort of caching mechanism. Then you can open the terminal and CD to your project and simply run maven rebuild commands like the following. All you need to do right now is to clean the project and then package your maven java project. mvnw clean package Now, try to run your project using the green triangle button that is usually used for running your maven project on the IntelliJ IDEA. That’s it, I hope t

Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

How To Create Spring Boot Project Using Netbeans

Spring Kafka - How to use ReplyingKafkaTemplate send and reply synchronously