Posts

Showing posts from January, 2025

Send OTP via SMS and Email using Azure Communication Services with Spring Boot

Image
This guide will walk you through the entire process of setting up Azure Communication Services, integrating it with Spring Boot, and sending OTPs via both SMS and email. 1. Setting Up Azure Communication Services (ACS) Step 1: Create an Azure Communication Services Resource Go to the Azure Portal → Search for Azure Communication Services → Click Create . Provide a name, subscription, resource group, and region. Click Review + Create , then Create . After the resource is created, go to the Keys section and copy the Connection String . Under Phone Numbers , purchase a phone number for sending SMS. Step 2: Set Up Email in ACS Under Azure Communication Services , configure the Email feature in the portal by following the setup steps. 2. Set Up Spring Boot Project Step 1: Create a Spring Boot Project You can create a Spring Boot project using Spring Initializr ( https://start.spring.io/ ): Project: Maven Project Language: Java Spring Boot Version:  3.x.x or higher Dependencies: S...

Spring AI with Typesense Vector Database: Spring Boot Integration Guide

Image
In modern AI-powered applications, vector search is a crucial component for enabling fast, efficient, and intelligent information retrieval. TypeSense , an open-source search engine, provides robust vector-based search capabilities, making it an excellent choice for integrating AI-driven search functionality into applications. This sequence diagram shows the interaction between the User , ProductController , ProductRepository , TypeSenseTemplate , and the TypeSense Database during two main operations: saving and searching for a product. Saving a Product : The User sends a POST request with product data to the ProductController . The ProductController passes the data to the ProductRepository , which calls the TypeSenseTemplate to store the product using the upsert() method. The TypeSenseTemplate communicates with the TypeSense Database , which saves the product. The ProductController responds to the User , confirming that the product has been saved. Searching for Products : The ...

Send Bulk Emails Using Azure Batch, Azure Functions, Azure Communication Services& Python – Step-by-Step Guide

Image
Here’s a complete end-to-end guide on how to send bulk emails using Azure Batch, Azure Functions, Python, and Azure Communication Services (ACS) . Overview This guide covers: ✅ Using Azure Functions to trigger bulk email processing ✅ Using Azure Batch for parallel processing of emails ✅ Using Azure Communication Services (ACS) to send emails ✅ Storing email lists in Azure Blob Storage ✅ Implementing everything in Python Prerequisites Make sure you have the following: ✔️ Azure Subscription ✔️ Azure Batch Account ✔️ Azure Storage Account (for storing email lists) ✔️ Azure Communication Services (ACS) Email setup ✔️ Python 3.8+ installed ✔️ Azure Functions Core Tools Step 1: Set Up Azure Communication Services (ACS) Email 1️⃣ Create an ACS Resource: Go to Azure Portal → Azure Communication Services → Create a new resource Copy the Connection String from the Keys section 2️⃣ Enable Email Communication: Go to the Email section in ACS Configure a verified email sender domain Get t...

Optimizing Fetching Strategies with Spring Data JPA Entity Graph | Avoid N+1 Problem

Image
Diagram Explanation: The User sends a request to the CustomerService to get customer data. CustomerService calls the CustomerRepository to execute a query that includes the findAllWithOrders() method, which uses the Entity Graph . CustomerRepository sends a query to the Database , which fetches both the Customer and associated Order entities in a single query. The Database returns the data, which is passed back to the CustomerRepository , then to the CustomerService , and finally returned to the User . In Spring Data JPA , an Entity Graph is a way to define which associations should be eagerly loaded when querying an entity. It can be used to fetch related entities in a single query, improving performance and avoiding the N+1 query problem . Entity Graph Example Let's create an example using an entity graph to eagerly load relationships in a Spring Data JPA application. Scenario : Consider the following two entities: Customer Order Each Customer can have multiple Orders ...

Spring AI with Pinecone Vector Database: Spring Boot Integration Guide

Image
Explanation of the Component Diagram User & Postman The user interacts with the Spring Boot API using Postman to test API requests. Spring Boot API Layer The request first hits the VectorController , which handles API endpoints for storing and searching vectors. The VectorService processes the request, embedding text into vectors using Spring AI . AI & Vector Processing Spring AI generates embeddings (vector representations of text). It then interacts with Pinecone Vector Database to store or retrieve vectorized data. Response Flow Pinecone returns search results to Spring AI . The response propagates back through VectorService → VectorController → Postman , where the user sees the JSON response. Here's a Spring Boot guide that integrates Spring AI with Pinecone Vector Database , covering: ✅ Spring Boot setup ✅ Spring AI & Pinecone integration ✅ Storing text embeddings with metadata ✅ Advanced retrieval using filtering ✅ Complete REST API for insertion & retr...