Reactive database transaction with Vertx
IntroRecently I needed to create an app using Micronaut’s Reactor for my work, fundamentally it makes your JVM application run in an unblocking manner and thus increases the throughput.
The project needs to do database transactions and since documentation does not contain the integration with Micronaut’s reactor core library, I am writing this post.
If you want to check the documentation from the micronaut page you can check this link.
The codeI am writing this in Groovy, but it will be similar ...
Realtime Data with MariaDB and Websocket [Part 2]
IntroThis is part 2 of the “Realtime Data with Mariadb” Series, if you haven’t got the chance to read part 1 I highly recommend to read it first.
WebsocketNow that we’ve successfully listened to database changes, we want to streamline it with WebSocket.
In this example I am using Micronaut’s websocket feature, you are obviously free to choose any framework or even implement it yourself.
As usual all the code in this article will be available here
Project SetupLet’s start by creating a micronaut ...
Realtime Data with MariaDB and Websocket [Part 1]
GoalWe are going to learn and build a service that serves real-time data with MariaDB as the underlying database.
Why?User expectations are increasing, and real-time data has become mandatory for a great web application. In this article, we are going to see possible options to build real-time data that serves data with MariaDB as our database.
There are a lot of software that offers this kind of real-time feature, one of them is debezium another is supabase, but we are going to create it our own ...
How to Prevent Duplicate Data with Idempotency Key
What is idempotency ?
Idempotence is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application.
When 2 identical requests are sent almost at the same time, your service must handle them accordingly, for example, if a web app sends a duplicate request to book (due to various reasons) a movie ticket, the service must understand which request should be accepted and only process one.
H ...
Building Authentication Service with TOTP (Time-Based OTP) Part 2. The Client
If you haven’t read the first part, I highly recommend to check first.
Series
Building Authentication Service with TOTP (Time-Based OTP) Part 1. The Server
Building Authentication Service with TOTP (Time-Based OTP) Part 2. The Client
Optional Requirement
http server
GoalIn this part two of the series we are going to build a client using HTML and javascript (jQuery). The finished product will be 2 pages one for login and the other for registering.
In the register page, when the user successfu ...
Building Authentication Service with TOTP (Time-Based OTP) Part 1. The Server
Series
Building Authentication Service with TOTP (Time-Based OTP) Part 1. The Server
Building Authentication Service with TOTP (Time-Based OTP) Part 2. The Client
Pre-requisite
Java 17
Micronaut
Goal
In this two-part series, we are going to build a web application and a REST API service.
After finishing this series hopefully, we get a better understanding of what TOTP is and how to implement it.
We are going to build the REST API using Java with Micronaut framework and the Web App using the go ...
Managing Context in Express Application
Pre-requisite
NodeJs
Why?When creating a Web API, there is a need to manage a client’s context so that when it’s required in a function, the function gets the correct context and processes the data.
To achieve that, we often pass parameters to each function.
1234567891011121314//illustrationfunction (req, res) { const user = req.user validateuser(user);}function validateUser(user) {}function getProducts(user) { updateUserLastVisit(user);}function updateUse ...
MQTT with RUST and NodeJs
Pre-requisiteYou need to make sure that these are installed in your environment :
Rust
Cargo
Node Js
What is MQTT ?MQTT (Message Queuing Telemetry Transport) is another messaging protocol designed to be lightweight so it can be used in IOT devices.
The basic idea is pub-sub, devices connected to a message broker and they exchange data by subscribing (to receive) or publishing (to broadcast).
You can read a more detailed info on what is MQTT in this link.
We are now going to simulate a MQTT con ...