Skip to Content

Introduction

Today, the use of cloud services is necessary, since it is the logical path to the evolution of IT systems. Each cloud provider offers a series of services and we, as developers, have to know how to use/integrate these services.

Using different services from different cloud providers, we can provide a complete solution to business without any limitations.

 

This blog post explains a proof of concept that how to use AWS SNS in SAPUI5 application.

 

 

Development

What is AWS SNS?

Amazon Simple Notification Service (SNS) is a flexible, fully managed pub/sub messaging and mobile notifications service for coordinating the delivery of messages to subscribing endpoints and clients. With SNS you can fan-out messages to a large number of subscribers, including distributed systems and services, and mobile devices.

 

PoC architecture:

 

We need a little knowledge of other AWS services:

  • API Gateway: Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. You can create an API that acts as a “front door” for applications to access data, business logic, functionality from your back-end services, code running on AWS Lambda, or any web application.

 

  • Lambda: AWS Lambda lets you run code without provisioning or managing servers. With Lambda, you can run code for virtually any type of application or backend service – all with zero administration. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.

 

Our application will call API Gateway to start the notification process in AWS. API Gateway will execute Lambda function. Lambda will invoke AWS SNS and AWS SNS will publish message in the selected topic.

 

 

AWS SNS

We created in AWS Console a new topic in AWS SNS:

 

Fill necessary fields:

 

When you have topic created, you need to create a subscription in your topic:

 

In this PoC, I choose a SMS protocol but you have different interesting options:

 

 

Lambda

Now, we need a lambda function to call AWS SNS.

 

We create a new lambda function:

Note: the role assigned needs AWS SNS permission to execute the SNS service. You can create a new policy with necessary SNS policies and attach it to a role.

 

When function is created, you can write the code to execute SNS service:

 

 

API Gateway

At last in AWS, a new api was created to call lambda service:

 

After API creation, you need to create a new resource (in this case was notify) and a new method (in this case was POST):

 

 

Note: For this PoC, I didn’t use Authorization and API Key. For a real project, please, use it:

 

Now you can configure your API to consume lambda function:

 

When you finish your configuration, you can test the API (and complete process) clicking on Test button:

 

Fill message test and click test:

Result:

Note: First, you need deploy API to a stage to use it.

 

 

SAPUI5 Application

Now, we will use SNS service in our SAPUI5 application. I created a SAPUI5 application with empty view.

 

I drew a simple layout:

 

And I wrote a simple function associated to “Send Notification” button:

Note: Yes… We must never use urls in our code… But for this PoC, it’s ok

 

With these steps, you can send notifications from you SAPUI5 app using AWS services!

 

Example:

  • SAPUI5 app:

 

  • My mobile device:

 

 

 

Conclusion

As you can read in the blog post, SAPUI5 gives us the opportunity to use SAP Cloud Platform services and cloud services from other providers (in our case AWS).

 

Compared with the old ABAP applications development, SAPUI5 gives us the opportunity to develop really interesting applications with a high possibility in the services consumption. This allows us to create applications, which were previously almost impossible to create.

Now, we have to play with different services and programming languages, which it makes … the applications development really fun!

Let’s all play!

 

Thanks to read this blog post!

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Shai Sinai

    Nice POC.

    However, I must say that I don’t see any real added value ofSAPUI5 in this case (“Compared with the old ABAP applications development”). You may achieve exactly the same in good old ABAP (with cl_http_client, for example).

    (0) 
    1. Javier Martinez Solera Post author

      Indeed, you could use the classic ABAP to do the same, even use it in a Java web dynpro. It’s just a test I did to see how to use the AWS SNS. Thanks for reading my post 😊

      (0) 

Leave a Reply