This is how we faced the challenge of creating a notification sns services.
- Take-home Microservices Challenge
- Table of contents
- Overview
- Screenshot
- Links
- Built with
- How I did it
- Continued development
- Author
- Acknowledgments
The design is structured as shown:
- src|
- main
- java|
- com/xxx/challenge/notificationSnsService|
- config
- dto
- consumer
- service
- test
- com/xxx/challenge/notificationSnsService|
- Live Site URL: [https://www.ferreiras.dev.br]
package com.gila.challenge.notificationSnsService.service;
import com.amazonaws.services.sns.AmazonSNS;
import com.amazonaws.services.sns.model.PublishRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MessageSnsService {
@Autowired
private AmazonSNS amazonSNS;
public void notify(String phone, String message, String name) {
PublishRequest publishRequest = new PublishRequest()
.withMessage(message)
.withPhoneNumber(phone)
.withSubject(name);
amazonSNS.publish(publishRequest);
}
}
- maybe
- [https://spring.io/projects/spring-cloud-aws] eases the integration with hosted Amazon Web Service
- [http://aws.amazon.com/sns/] Annotation-based mapping of [SNS] endpoints (HTTP)
- Website - [https://ferreiras.dev.br]