In the situation of extesionsibility options determination like the following picture, to keep core system clean,for loose coupled application extension, we recommand to use side-by-side extensibility on BTP. In decoupled application, BTP Event Mesh play an important role.  We can realize some requirements with Integration instead of side by side extention.Today I will demo how use CPI AMQP adapter to test BTP event mesh.In my following blogs, I will introduce how to use CPI to realize  some logic triggered by  S/4 Hana Cloud event .

Prerequisite:

  • For Event Mesh, you have finished the following 3  steps:

  1. Get Started with the Event Mesh User Interface
  2. Setting Up SAP Event Mesh in BTP Cockpit
  3. Creating an Event Mesh Instance Using the Default Plan,you will event mesh instance service key like the following:

Testing Steps:

1, Create Event queue as help .

 

2 Create oauth2 client credential in CPI

3 Create and deploy iflow in CPI to consume event from event queqe in Event Mesh

/* Refer the link below to learn more about the use cases of script.
https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/148851bf8192412cba1f9d2c17f4bd25.html

If you want to know more about the SCRIPT APIs, refer the link below
https://help.sap.com/doc/a56f52e1a58e4e2bac7f7adbf45b2e26/Cloud/en-US/index.html */
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
    //Body
    def body = message.getBody(java.lang.String);
    
    def messageLog = messageLogFactory.getMessageLog(message)
    
        if (messageLog != null) {
        messageLog.addAttachmentAsString('Em content', body, 'text/plain')
    }
    return message;
}

4 Create and deploy iflow in CPI to produce event to event queqe in Event Mesh

 

5 Use postmen to send message  to eventissue iflow in step4

6 Check result in iflow of event consuption

 

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x