May 2018
Intermediate to advanced
390 pages
9h 31m
English
Let's create a listener NotificationListener class that will be used to listen to messages on the Kafka notification topic and send email and SMS notifications to the customer:
@Componentpublic class NotificationListener {@StreamListener(NotificationStreams.INPUT)public void sendMailNotification(@Payload Notification notification) {System.out.println("Sent notification to email: "+notification.getEmail()+" Message: "+notification.getMessage());}@StreamListener(NotificationStreams.INPUT)public void sendSMSNotification(@Payload Notification notification) {System.out.println("Notified with SMS to mobile: "+notification.getMobile()+" Message: "+notification.getMessage());}}
The NotificationListener class has two methods— ...
Read now
Unlock full access