Skip to Content
Product Information

SAP EM – Message Broker for Events S4

Hello ALL,

I would like to share with you my experience with this SAP product for Queuing process – SAP Enterprise Messaging, the consultant Pradeep Panda wrote a very nice blog how to quick start with SAP EM with the instructions how to setup up the product and create your own instance to start work with this product, you can check at this link – Blog Pradeep Panda

I will not, in this case, repeat the same steps of the blog but I will post and explain how the product works and why many details I will just post the HELP SAP because there you can find more details and others.

Basically the SAP Enterprise Messassing it’s an SAP product for Cloud Platform that can be set up on Foundry, it’s not available yet for NEO, that you can use on your landscape as a platform to make Queue process.

What is the SAP EM? 

SAP Enterprise Messaging

What is the difference between Cloud NEO and Foundry?

NeoVSFoundry

How to use the SAP EM?

You can try as a trial version with SAP Cloud Platform and in case of the project, the respective client must buy the license for the product together with SAP. Remind you that you need to set up on Foundry, so if you have SAP CPI on NEO and want SAP EM, you need to buy the license for Foundry.

Case to use SAP EM will be for asynchronous queue scenarios with some types of integration patterns for example: publish and subscribe.

The sample of Architecture designer – CPI plus EM:

 

What are the protocols that SAP EM supports?

After this short introduction, you can get more deep details on the SAP Documents that I will include a reference at the end of this blog.

So let’s start, are you ready?

Good to know that your answer it’s yes, I will post some details and pictures but major one you can see in the blog of Pradeep Panda of the cockpit and the instance, also I will show you a full hands-on using the protocol HTTPREST, the other protocols supported by SAP EM as MQTT and AMQP I will provide more details in another blog in soon future.

Before you start the hand’s on for test the protocol HTTPREST in case of your S4/HANA is not at 1809 SP01 you will need to use the POSTMAN product, so download it fast, with it you will be able to MANAGEMENT and MESSAGING on the SAP EM using off course – HTTPS call with Token and Basic Authentication.

I will not explain all steps of the set up because on the blog of Pradeep you already can check that.

SAP Cloud Foundry with SAP EM product release:

The cockpit of Foundry – I remove all details of the company and account, but how it looks like – You need to create your space inside Foundry product as you can see below with one space available with three users with access.

Space:

Service Marketplace to check if the services of SAP Enterprise Message it’s released:

If until now and if you follow the blog of Pradeep, you will need to create your own instance of SAP EM to receive the messages and store in queues and topics.

The cockpit of the instance on SAP EM to create the queues and others:

Dashboard you can create and delete the queues and topics:

Later one you need to set up the topics and tied to the Queue of topics you created before.

Boring until now?

Calm… let’s start the hand’s on the part now.

So now I have the SAP Enterprise Messaging on, space, instance, queues and topic setup up, now what I need to do to start work with this product?

You need to generate the KEY, this will be your reference of USER/PASS and START ADDRESS of endpoints that you need use for Management and Messaging.

Create a Service Key, you just need to give a name and will generate to you with high light details of important data, the format of this file it’s JSON. Save it local

Now what we need to do? Previous I mentioned that I will show only the HTTPREST protocol and for that, you need to download POSTMAN to send the data.

I will take coffee until you download and install…

I’m back, now with post man you need to get some information on the JSON file and set up the endpoint for the first call, this first call you will take the token, obligatory for next steps.

When you open the JSON file, you will need to build the endpoints, the important informations:

Values on Json file:

"clientid": "USER",
"clientsecret": "PASS",
"tokenendpoint": "https://{SAP_EM_SPACE}.authentication.eu10.hana.ondemand.com/oauth/token",

The address above it’s to take the token and for that you need add in the end:

–> ?grant_type=client_credentials&response_type=token

The address will be:

https://{SAP_EM_SPACE}.authentication.eu10.hana.ondemand.com/oauth/token?grant_type=client_credentials&response_type=token

Postman test:

The success you will receive the JSON message:

{
"access_token": "TOKEN",
"token_type": "bearer",
"expires_in": 43199,
"scope": "uaa.resource",
"jti": "362672fcdf3d4ca390e99a7264c06684"
}

Extract the value of “access_token”.

Now finally we will start the action, first let’s use the management to check what are the queues registered on SAP EM system, something that you did via dashboard before.

Management Action on SAP EM, for that you also need build all endpoint:

On JSON File you will see:

Take the value of “uri” and add – /hub/rest/api/v1/management/messaging/queues

The endpoint will be:

https://enterprise-messaging-hub-backend.cfapps.eu10.hana.ondemand.com/hub/rest/api/v1/management/messaging/queues

Add on the setup of POSTMAN the details in the header the parameters: Authentication (Token Value )and Content-Type (application/json):

Send the data, if successful you will receive HTTP 200 and the JSON value with the queues registered on the SAP EM:

 

Now it’s time for show, I have all steps in place and two queues on SAP EM to receive data, to send data you also need build the endpoint, but now you need to go for the JSON file and check the part of messaging, there is only two parts on JSON – Management and Messaging with three different protocols mentioned above – MQTT / AMQP and HTTP REST.

Check the value of HTTPREST in the end and build the endpoint to POST and Consumption the message from the queue, it’s simple.

Take the value from uri plus

/messagingrest/v1/queues/{QueueNameRegistred}/messages

Full address:

https://enterprise-messaging-pubsub.cfapps.eu10.hana.ondemand.com/messagingrest/v1/queues/{QueueNameRegistred}/messages

Now the hard part, you did all steps and you want to send the data after setup all, user,pass etc..etc.. but you are receiving HTTP 401 or HTTP 500, you need to remove from the Header the TOKEN as authentication and add Bear Token as Authentication with token value in another part, after that you will be able to send message, check images below:

Now you will be able to send the data to the queue, sample below special for SAP community – ps: You can send many different types of CONTENT-TYPE not only text/plain

Send the data, if you received HTTP 204 – Empty message, it’s correct:

Now let’s go for the previous GET on Management to check what is the queue with value:

Now I would like to see that is the data inside the queue, what I must to do?

The same address that you POST the data, in the end, you must add /consumption

https://enterprise-messaging-pubsub.cfapps.eu10.hana.ondemand.com/messagingrest/v1/queues/{QueueNameRegistred}/messages/consumption

When your consumption the queue based on content or topic, automatically SAP EM delete the register, look the sequence below:

Don’t send body because you are not registering now and reading from the queue, send the message:

If you try again you will receive the JSON below:

{"message": "queue is empty"}

 

I hope with this you got what is this product and what you can do with it, see you around in the community.

 

Reference Documents:

Thank you,

 

BR,

 

“Viana”

 

 

 

 

 

 

 

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