What is Amazon SNS And How To Integrate With Java

Posted By : Vikash Patwal | 21-Sep-2018

 

Amazon Simple Notification Service (Amazon SNS) is a web benefit that directions and deals with the conveyance or sending of messages to buying in endpoints or customers. In Amazon SNS, there are two sorts of customers—distributers and supporters—additionally alluded to as makers and buyers. Distributers discuss concurrently with supporters by creating and making an impression on a theme, which is a sensible passageway and correspondence channel. Endorsers (i.e., web servers, email addresses, Amazon SQS lines, AWS Lambda capacities) devour or get the message or warning more than one of the bolstered conventions (i.e., Amazon SQS, HTTP/S, email, SMS, Lambda) when they are bought into the theme

 

When utilizing Amazon SNS, you (as the proprietor) make a subject and control access to it by characterizing arrangements that figure out which distributers and endorsers can speak with the theme. A distributer sends messages to subjects that they have made or to points they have authorization to distribute to. Rather than including a particular goal address in each message, a distributer makes an impression on the subject. Amazon SNS coordinates the subject to a rundown of supporters who have bought into that theme and conveys the message to every one of those endorsers. Every theme has an exceptional name that distinguishes the Amazon SNS endpoint for distributers to present messages and supporters on enlisting for warnings. Supporters get all messages distributed to the subjects to which they buy in, and all endorsers of a theme get similar messages.

 

SNS Class-:

    public static void pushSNSMessage(String lambdaName,String message)
	
          {
            //Aws credentianl for access AWS Console
	   AmazonSNSClient snsClient = new AmazonSNSClient(new BasicAWSCredentials(ApiConstant.S3_ACCESS_KEY, ApiConstant.S3_SECRET_KEY));
	   snsClient.setRegion(Region.getRegion(Regions.EU_WEST_1));
	   //create a topic
           CreateTopicRequest createTopicRequest = new CreateTopicRequest("new-Notifications");
	   CreateTopicResult createTopicResult = snsClient.createTopic(createTopicRequest);
            //publish topic
	    PublishRequest publishRequest = new PublishRequest(createTopicResult.getTopicArn(), "");
	    publishRequest.setSubject(lambdaName);
	    publishRequest.setMessage(message);
	    snsClient.publish(publishRequest);
	}
 
 

 

 

 

About Author

Author Image
Vikash Patwal

Vikash Patwal is Masters in Computer Applications and good in Java , he is hardworking team player.

Request for Proposal

Name is required

Comment is required

Sending message..