React to events and connect 3rd Party systems using Serverless services & Open Connectors (Part 1)
SAP Cloud Platform (SAP CP) offers serverless services for messaging-as-a-service (MaaS), functions-as a-service (FaaS), and backend-as-a-service (BaaS) to create modular, scalable application architectures that respond to business events from various sources. This helps in building responsive (event-driven) applications. By serverless, we mean that SAP (as a provider) will take care of managing & dynamically scaling the resources required to run these services. Customers would pay only for the resources which are used and not for the idle time.
So where do we use these serverless services. In the TechED keynote, Bjoern emphasized on “Keep the core clean”. When you need to build extensions for your core systems, build responsive apps/micro-services as extensions on the Cloud Platform which listen to events in the core system. These extension apps could then execute certain task and connect with other system.
- Messaging as a service: SAP Cloud Platform Enterprise Messaging (generally available) – Use this service to send and receive messages & events. It supports asynchronous communication between sender and receiver using standard messaging protocols and exchange patterns (such as publish/subscribe)
- Functions as a service: SAP Cloud Platform Functions (beta) – Functions are atomic piece of code which can get triggered via HTTP/Timer/Events. Only when the trigger occurs, a function is executed. This has been integrated into SAP WebIDE and developers can use nodejs. Functions in SAP CP is similar to AWS lambda or Google functions.
Here is a blog post which describes more about these services “How to use SAP Cloud Platform Functions and Enterprise Messaging to build agile, responsive applications and “keep the core clean” by Elisabeth Riemann
- Backend as a service: SAP Cloud Platform Backend service (beta) – This service enables developers to build OData/RESTful services by providing a data model as input (CDS or edmx). The service creates APIs with QCRUD capabilities and the supporting backing services like persistence and caching. Behind the scene, a schema gets generated in the DBaaS (which is bound to the service) and the APIs can be used to create/query entries in the schema.
You can use all these 3 services together or use them standalone depending on your requirement.
At TechED, SAP also announced the availability of Open Connectors which provide over 150+ adapters to tap into non-SAP systems. Open Connectors help in bringing together both SAP and non-SAP systems and help in orchestrating processes between these systems.
In this blog post, I am going to show how to use the serverless services along with Open Connectors. The best part is that all these services are available to try in the Trial environment. The scenario I am using for this blog post involves an event being triggered by an SAP system which pushes a message to the Enterprise Messaging service. There is a function which listens to this event and reads this message and uses Open Connectors to post the data as a Twitter feed.
|React to events and connect 3rd Party systems using Serverless services & Open Connectors|
Part 1 – Configuring SAP Cloud Platform Open Connectors
Part 2 – Setup Queues in Enterprise Messaging service
Part 3 – Create Functions & Triggers in Functions service
Part 4 – Create a OData/Restful service using Backend service
This part of the blog post focuses on configuring SAP Cloud Platform Open Connectors.
Let’s start by configuring SAP CP Open Connectors. Navigate to the services cockpit of your trial account (Neo environment).
When you launch the Open Connectors application, it will take you to the Admin screen where you can find list of all available connectors and the instances you have created. In the connectors menu, look for the “Twitter” connector and select “Authenticate”
Provide a name for your instance and click on the “Create Instance” at the bottom
This will request you to login to your twitter account in another window and authenticate you. Once you have been authenticated, the system will take you to the API Docs where you will be able to find the list of all available APIs to interact with Twitter.
For this scenario, I am going to use the POST operation on “statuses” entity to tweet something on my account. You can test the APIs here. Notice that the “Authorization” string has been pre-populated. Make a note of this along with the complete URL which you would obtain after testing this API here.
In the next blog, I will go through the configuration steps of Enterprise Messaging service.
Thanks Murali Shanmugham for the nice blog series. I want to use cloud function to call on-premise S/4HANA odata service. Can I use destination configured in neo platform to connect to the on-premise system?
Thanks Sumit. Since these services are in the CF environment, you would need to create destination to the S/4HANA OData service and refer them in the Function service