Features of Adapter Microservices
This section lists the features of Adapter Microservices.
Execute Remote REST API for a Command Event
The following depicts the style of mediation expected from ms adapter microservice.
Adapter microservice provides Programmatic invocation of Mediation Engine which supports the following.
- Data Transformation rules to transform input/output payload into the target API request/response.
- Route configuration will be stored in Configuration MS.
- Inbox-outbox enabled for all events handled.
Notice the below event request, and also notice the "party.partyCreated" is the naming scheme which needs to be used.
- Name of the microservice/service.
- Name of the API to be executed.
{
"eventId": "4676cd2c-0d22-11eb-adc1-0242ac120002",
"dateTime": 1576074808386,
"correlationId": "4676cde0-0d22-11eb-adc1-0242ac120002",
"priority":0,
"status":"new",
"eventType":"adapter-framework_party.partyCreated",
"payload":{
"customerId ": "100100"
}
}
Provide GET API Endpoint for Data File
Adapter microservice provides Programmatic invocation of Mediation Engine, which supports GET API Function implementation. Programmatic invocation of mediation logic helps you to:
- Understand inputs from API.
- Pick up a data flat file from shared directory.
- Transform file data in the form of API response.
Support Bulking Feature for Data Events (In Design phase)
The Adapter microservice will provide Programmatic invocation of Mediation Engine which supports GET API Function implementation. Programmatic invocation of mediation logic helps you to:
- Receive Command Events and persist in a data MS datastore.
- Using Scheduler capability, periodically, it invokes command function:
- Collect events
- Programmatic invocation of mediation engine, which
- Transforms events data into record data in a file format.
- Writes the file into file store configured.
MDAL Cache
Overview
Adapter MS needs an MDAL cache for creating an MDAL Cache Manager to manage, store and retrieve data from the required API. Instead of being data heavy, MDAL stores some data in the cache. This ensures that retrieval is faster and less time consuming.
The following figure shows the high level design of the MDAL Cache Integration.
MDAL cache update is a 2-step process.
- The event is sent to the Adapter MS.
- The Adapter MS updates the required data in MDAL Manager.
Generic Config APIs
POST/system/configurationGroups/ADAPTER.CONFIG/configuration/MDALEventTest
{
"configData": { "data":"cHJvY2Vzcy5yb3V0ZUlkPWRpcmVjdDptZGFsLmNhY2hlLnVwZGF0ZQ0KcHJvY2Vzcy5yb3V0ZT1UZXN0TURBTEFwcGxpY2F0aW9uQ29udGV4dA0KVGVzdE1EQUxBcH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ZzTG1OaFkyaGxMblZ3WkdGMFpTSStEUW9KQ1FrOFpuSnZiU0IxY21rOUltUnBjbVZqZERwdFpHRnNMbU5oWTJobExuVndaR0YwWlNJdlBnMEtDUWtKUEdKbFlXNGdjbVZtUFNKTlJFRk1SWFpsYm5SUWNtOWpaWE52Y2lJdlBnMEtDUWs4TDNKdmRYUmxQZzBLSUNBZ0lEd3ZZMkZ0Wld4RGIyNTBaWGgwUGcwS0lDQWdJRHhpWldGdUlHbGtQU0pOUkVGTVJYWmxiblJRY205alpYTnZjaUlnWTJ4aGMzTTlJbU52YlM1MFpXMWxibTl6TG0xcFkzSnZjMlZ5ZG1salpTNXRaV1JwWVhSdmNpNWxibWRwYm1VdVRVUkJURVYyWlc1MFVISnZZMlZ6YjNKVVpYTjBNaUl2UGcwS1BDOWlaV0Z1Y3o0PQ==",
"configType": "json"
},
"name": "MDALEventTest",
"id": "MDALEventTest",
"version": "1.0.7"
}
{
"id": "MDALEventTest",
"name": "MDALEventTest",
"version": "1.0.7"
}
GET/system/configurationGroups/MDLPTY.Party/configuration/getCustomerShortNames
{
"configData": { "data":"ewoJImVuZHBvaW50IjogewoJCSJiYXNlUGF0aCI6ICJodHRwOi8vMTAuOTMuMjQuMTU6OTc5Ny9hcGkvdjIuMC4wIiwKCQkiaGVhZGVyIjogIiIsCgkJInJlc3BvbnNlUm9vdCI6ICIvYm9keSIsCgkJInVyaSI6ICIvcGFydHkvY3VzdG9tZXJzL3tjdXN0b21lcklkfS9zaG9ydE5hbWVzIiwKCQkicmV0dXJuVHlwZSI6ICIiCgl9Cn0=",
"configType": "json"
},
"name": "getCustomerShortNames",
"id": "getCustomerShortNames",
"version": "1.0.7"
}
{
"id": "getCustomerShortNames",
"name": "getCustomerShortNames",
"version": "1.0.7"
}
Adapter MS Business event
This business topic is used to receive topics that contain updates in the MDAL. The MDAL Manager uses this to update the given data.
Event Topic: ms-adapterservice-event-topic
Sample Request for Event Topic
{
"specversion": "1.0",
"id": "1700a605c-69b6-457c-81e4-482339454a85",
"source": "https://temenos.com/microservice/cloudevents/ms_party",
"type": "MDALEventTest",
"datacontenttype": "application/json",
"subject": "event",
"time": "2020-11-04T03:54:58.567Z",
"correlationid": "170216e8-3ca-9-b-8822",
"data": {
"mdalevent": [
{
"target": "MDLPTY.Party",
"scope": "party",
"parameters": [
{
"key": "customerId",
"value": "101022"
}
]
}
]
}
}
Configuring MDAL Cache
MDAL Route
The following route explains the data being sent to the MDAL cache manager which is used for updating data in cache.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="direct:mdal.cache.update">
<from uri="direct:mdal.cache.update"/>
<bean ref="MDALEventProcesor"/>
</route>
</camelContext>
<bean id="MDALEventProcesor" class="com.temenos.microservice.mediator.engine.MDALEventProcesorTest2"/>
</beans>
MDAL Properties Required
Each MDAL has a target which is used as the key namespace for each of the configuration application. This specifies the API endpoint that is used for the updating.
{
"endpoint": {
"basePath": "http://10.93.24.15:9797/api/v2.0.0",
"header": "",
"responseRoot": "/body",
"uri": "/party/customers/{customerId}/shortNames",
"returnType": ""
}
}
Procedure:
- Extract the Generic Config pack and up the docker package.
- Extract the Adapter MS and change the value of the following.
TEMN_MSF_ADAPTER_CONFIG_CLASSPATH: "true" to TEMN_MSF_ADAPTER_CONFIG_CLASSPATH: "false"
- Change the value of the following to your local Ipv4 address.
temn.config.service.base.path: http://<Yout IP>:8095/ms-genericconfig-api/api/v1.0.0/
- Add the configuration to the http://localhost:8095/ms-genericconfig-api/api/v1.0.0/system/configurationGroups/Configuration.properties/configuration/party_partyCreated3.
In this topic