Subham Krishna software developer.

Subham Krishna software developer. Software developer,poet, determined,goal oriented hard worker with dedication towards work.

16/01/2026
14/01/2026

▶️ Stuck issue ------------/ways to make your pc/laptop faster:-

Press start button and search Commant Prompt and run as administrator =>sfc /scannow after that 100% type : DISM /Online /Cleanup-Image /RestoreHealth Press start button and search Commant Prompt and run as administrator >> DISM /Online /Cleanup-Image /ScanHealth Press start button and search Commant Prompt and run as administrator >> chkdsk Go to search >> %temp% => delete all temp files win + R =>prefetch => delete everything Go to search >>Type disk cleanup => clean Go to search >>Type services >> Windows Update >> disable win + R =>sysdm.cpl =>> advanced => settings => click adjust for best performance

31/12/2025

How to add project from pc to GitHub/gitlab.
23/12/2025

How to add project from pc to GitHub/gitlab.

9. After that Start all the services and it will work fine as required, sending emails whenever order event is triggered...
22/12/2025

9. After that Start all the services and it will work fine as required, sending emails whenever order event is triggered and request is send from the request producer to request consumer.

22/12/2025

8. After that make a package named as service(you can keep it anything but most preferably you should write the name as service as it is providing service of sending mail) and then make a class in it(here it's NotificationService) and write the following code to enable consumer to consume the request and act accordingly here sending mail) like this :

package com.techie.microservices.notification.service;

import com.techie.microservices.order.event.OrderPlacedEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.mail.MailException;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.mail.javamail.MimeMessagePreparator;
import org.springframework.stereotype.Service;




public class NotificationService {

private final JavaMailSender javaMailSender;

(topics = "order-placed")
public void listen(OrderPlacedEvent orderPlacedEvent){

log.info("Got Message from order-placed topic {}",orderPlacedEvent);
// Send email to the customer
MimeMessagePreparator messagePreparator = mimeMessage -> {
MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage);
messageHelper.setFrom("[email protected]");
messageHelper.setTo(orderPlacedEvent.getEmail());
messageHelper.setSubject(String.format("Your Order with OrderNumber %s is placed successfully",orderPlacedEvent.getOrderNumber()));
messageHelper.setText(String.format("""
Hi

Any msg in the body(here i'm providing message as Your order with order number %s is now placed successfully)

Best Regards
Spring Shop
""",
Any Dynamic msg you want to print in as %s variable Name(here it's orderPlacedEvent.getOrderNumber()));
};
try{
javaMailSender.send(messagePreparator);
log.info("Order Notification email sent!!");

}catch(MailException e){
log.error("Exception occurred when sending mailed");
throw new RuntimeException("Exception occured when sending mail to [email protected]",e);
}

}

}

22/12/2025

7. Go to project open in intellij/eclipse/SpringToolSuite and there make a package as order.event, there place this code with required variables as per your requirements and it should either match with schema defined in file defined as order-placed.avsc in avro folder in application.properties folder of module or with class defined with the same folder structure as in consumer's module as follows :

package com.techie.microservices.order.event;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;




public class OrderPlacedEvent {

private String orderNumber;
private String email;

}

or

Schema-registry file defined as order-placed.avsc in avro folder in application.properties folder of module:

{
"type": "record",
"name": "OrderPlacedEvent",
"namespace": "com.techie.microservices.order.event",
"fields": [
{ "name": "orderNumber", "type": "string" },
{ "name": "email", "type": "string" },
{ "name": "firstName", "type": "string" },
{ "name": "lastName", "type": "string" }
]
}

19/12/2025

6. After that add these properties to your project's module's application.properties file(consumer's application.properties file):

spring.application.name=notification-service
server.port=8084

Properties
spring.mail.host=sandbox.smtp.mailtrap.io
spring.mail.port=2525
spring.mail.username=a2adfdfdca22a5
spring.mail.password=confidential

Consumer properties
spring.kafka.bootstrap-service=localhost:9092
spring.kafka.consumer.group-id=notificationService
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer
spring.kafka.consumer.properties.spring.json.trusted.packages=com.techie.microservices.order.event

Address

Patna

Website

Alerts

Be the first to know and let us send you an email when Subham Krishna software developer. posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Share