Event Cloud
Event Formats specify how to serialize a CloudEvent with certain encoding formats. Compliant CloudEvents implementations that support those encodings must adhere to the encoding rules specified in the respective event format. All implementations must support the JSON format.
Attributes
Every CloudEvent conforming to this specification MUST include context attributes designated as REQUIRED, MAY include one or more OPTIONAL context attributes and MAY include one or more extension attributes.
The required attributes as part of CloudEvents specification v1.0 are given below:
- specversion - cloud event specification version
- id - unique identifier for the event
- type - type of event
- source - originating microservice name
The required attributes in Temenos MSF-CloudEvents context are given below:
- subject - event subject
- data - payload in an event
In MSF-CloudEvents context, the cloud event's type is identified using the subject attribute. It has five possible values:
- command
- event
- commandprocessed
- commandfailed
- commandreceived
The optional attributes are given below:
- time
- correlationid
- serviceid
- channelid
- organizationid
- tenantid
- datacontenttype
- extension-mscontext - Object containing the following attributes:
- authorization
- customfilterid
- operationinstanceid
- sequenceinstanceid
- priority
An extension attribute extension-mscontext has been introduced to accommodate event header information.
Header Information Available in Context
The following attributes in header are stored in context and can be retrieved as and when required.
- authorization
- customfilterid
- serviceid
- channelid
The header information is retrieved from context using below code snippet.
Map<String,String> headers = context.getRequest().getHeaders();
Enabling Cloud Events in MSF
By default, command ingester in MSF can process both GenericCommand/GenericEvent and CloudEvent as input.
However, outbox processor application in MSF produces only GenericEvent by default.
To produce cloud events from a microservice application, the following properties should be set for the corresponding inbox-outbox processor application.
|
Property |
Possible values |
Description |
Data type |
Default value |
|---|---|---|---|---|
|
temn.msf.ingest.is.cloud.event |
true / false |
To produce events as per cloud event specification |
String |
false |
|
temn.msf.ingest.cloud.event.serialize |
true / false |
To encode cloud event data in BASE64 format |
String |
false |
Cloud Events Schema
The following are the json files:
- CommandFailedEvent
- CreateNewPaymentOrder_CommandEvent
- CreateNewPaymentOrder_CommandReceivedEvent
- Account_CommandProcessedEvent
- PayeeDetailsEvent_BusinessEvent
Sample JSON Files
The following are the sample json files:
{
"specversion": "1.0",
"type": "ms-paymentorder.CreateNewPaymentOrder",
"subject": "command",
"source": "https://temenos.com/microservice/cloudevents/ms-paymentorder",
"id": "4216e8-3ca-9-b-8827",
"time": "2018-04-05T17:31:00Z",
"correlationid": "4216e8-3ca-9-b-8322",
"serviceid": "client",
"channelid": "web",
"organizationid": "org",
"tenantid": "ten",
"businesskey": "abc",
"sequenceno": 1,
"extension-mscontext": {
"authorization": "g7edmM9UZFlvkaAyAE672G388KK3NCcfFqWfgJ10hqrGUw9xHlZ4tSy3C7JousiMsM_jPNFCQ2p3thirPUn6cPCojokvqxaterPiNFlwA",
"customfilterid": "test",
"operationinstanceid": "opr",
"sequenceinstanceid": "seqinst",
"priority": 1
},
"datacontenttype": "application/json",
"data": {
"body": {
"fromAccount": "259981",
"toAccount": "5937",
"paymentReference": "PayRef",
"paymentDetails": "refDe",
"currency": "USD",
"amount": 124,
"expires": 1,
"fileContent": "",
"extensionData": {
"array_BusDayCentres": [
"India",
"Aus"
],
"paymentOrderProduct": "Temenos",
"array_NonOspiType": [{
"NonOspiType": "DebitCard",
"NonOspiId": "12456"
},
{
"NonOspiType": "UPI",
"NonOspiId": "12456"
},
{
"NonOspiType": "DebitCard",
"NonOspiId": "3163"
}
]
},
"paymentMethod": {
"id": 100,
"name": "paymentmethod",
"extensionData": {
"array_BusDayCentres": [
"India",
"Aus"
],
"paymentOrderProduct": "Temenos",
"array_NonOspiType": [{
"NonOspiType": "DebitCard",
"NonOspiId": "12456"
},
{
"NonOspiType": "UPI",
"NonOspiId": "12456"
},
{
"NonOspiType": "DebitCard",
"NonOspiId": "3163"
}
]
},
"card": {
"cardid": 1,
"cardname": "allwin",
"cardlimit": 1
}
},
"exchangeRates": [{
"id": 1,
"name": "allwin",
"value": 1
}],
"payeeDetails": {
"payeeName": "paydetail",
"payeeType": "visa"
},
"descriptions": [
"success"
]
}
}
}
{
"specversion": "1.0",
"id": "600a605c-69b6-457c-81e4-482339454a85",
"source": "https://temenos.com/microservice/cloudevents/PaymentOrder",
"type": "POAccepted",
"datacontenttype": "application/json",
"subject": "event",
"time": "2020-11-04T03:54:58.567Z",
"businesskey": "abc",
"sequenceno": 1,
"extension-mscontext": "{\"authorization\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJob2xkaW5ncyIsImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0Ojk0NDMvb2F1dGgyL3Rva2VuIiwic3ViIjoiMTkwMDA2MjU4ODQiLCJyb2xlSWQiOiJCYWxhbmNlVmlld2VyIiwiaWF0IjoxNTg5NTkzMTQwLCJleHAiOjE2MjExMjkxNDJ9.KiZCAFf6Iien5ZJE70fhGweJZ6ErmLqaKyz40lZnjVChmzSaFW3z7IUfqdt8370PNufLf_S79C8b0MgNJo1NHtTojhjUSGGtHFn98WTb8s7DJmLtAAnGAwm-RHWzRvhJVVBZO1VbbwA4-QJhBK30OjOxiJg1ujTpZrtOIqhZiFCjgWB9jmfg74iLou5nylVKo8YGR7ZANrVO_qxW5LhLuOfuGY7HKQ5iGUDjAeI_U7XZU7-edmM9UZFlvkaAyAE672G388KK3NCcfFqWfgJ10hqrGUw9xHlZ4tSy3C7JousiMsM_jPNFCQ2p3thirPUn6cPCojokvqxaterPiNFlwA\",\"customfilterid\":\"test\"}",
"correlationid": "4216e8-3ca-9-b-8822",
"serviceid": "client",
"channelid": "web",
"data": {
"paymentOrderId": "PO~259977~5937~USD~124",
"debitAccount": "259977",
"creditAccount": "5937",
"amount": 124,
"currency": "USD"
}
}
{
"specversion": "1.0",
"id": "e3a2992c-0c90-4b0b-a7ae-fe4bc19a5ed9",
"source": "https://temenos.com/microservice/cloudevents/PaymentOrder",
"type": "CommandReceived",
"datacontenttype": "application/json",
"subject": "commandreceived",
"time": "2020-11-04T03:54:35.143Z",
"correlationid": "4216e8-3ca-9-b-8822",
"businesskey": "abc",
"sequenceno": 1,
"data": {
"specversion": "1.0",
"id": "4216e8-3ca-9-b-8822",
"source": "https://temenos.com/microservice/cloudevents/https://temenos.com/microservice/cloudevents/ms-paymentorder",
"type": "PaymentOrder.CreateNewPaymentOrder",
"datacontenttype": "application/json",
"subject": "command",
"time": "2018-04-05T17:31Z",
"organizationid": "org",
"businesskey": "abc",
"sequenceno": 1,
"extension-mscontext": "{\"authorization\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJob2xkaW5ncyIsImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0Ojk0NDMvb2F1dGgyL3Rva2VuIiwic3ViIjoiMTkwMDA2MjU4ODQiLCJyb2xlSWQiOiJCYWxhbmNlVmlld2VyIiwiaWF0IjoxNTg5NTkzMTQwLCJleHAiOjE2MjExMjkxNDJ9.KiZCAFf6Iien5ZJE70fhGweJZ6ErmLqaKyz40lZnjVChmzSaFW3z7IUfqdt8370PNufLf_S79C8b0MgNJo1NHtTojhjUSGGtHFn98WTb8s7DJmLtAAnGAwm-RHWzRvhJVVBZO1VbbwA4-QJhBK30OjOxiJg1ujTpZrtOIqhZiFCjgWB9jmfg74iLou5nylVKo8YGR7ZANrVO_qxW5LhLuOfuGY7HKQ5iGUDjAeI_U7XZU7-edmM9UZFlvkaAyAE672G388KK3NCcfFqWfgJ10hqrGUw9xHlZ4tSy3C7JousiMsM_jPNFCQ2p3thirPUn6cPCojokvqxaterPiNFlwA\",\"customfilterid\":\"test\",\"sequenceinstanceid\":\"seqinst\",\"operationinstanceid\":\"opr\",\"priority\":1}",
"tenantid": "ten",
"correlationid": "4216e8-3ca-9-b-8321",
"serviceid": "client",
"channelid": "web",
"data": "{\"body\":{\"fromAccount\":\"259977\",\"toAccount\":\"5937\",\"paymentReference\":\"PayRef\",\"paymentDetails\":\"refDe\",\"currency\":\"USD\",\"amount\":124,\"expires\":1,\"fileContent\":\"\",\"extensionData\":{\"array_BusDayCentres\":[\"India\",\"Aus\"],\"paymentOrderProduct\":\"Temenos\",\"array_NonOspiType\":[{\"NonOspiType\":\"DebitCard\",\"NonOspiId\":\"12456\"},{\"NonOspiType\":\"UPI\",\"NonOspiId\":\"12456\"},{\"NonOspiType\":\"DebitCard\",\"NonOspiId\":\"3163\"}]},\"paymentMethod\":{\"id\":100,\"name\":\"paymentmethod\",\"extensionData\":{\"array_BusDayCentres\":[\"India\",\"Aus\"],\"paymentOrderProduct\":\"Temenos\",\"array_NonOspiType\":[{\"NonOspiType\":\"DebitCard\",\"NonOspiId\":\"12456\"},{\"NonOspiType\":\"UPI\",\"NonOspiId\":\"12456\"},{\"NonOspiType\":\"DebitCard\",\"NonOspiId\":\"3163\"}]},\"card\":{\"cardid\":1,\"cardname\":\"allwin\",\"cardlimit\":1}},\"exchangeRates\":[{\"id\":1,\"name\":\"allwin\",\"value\":1}],\"payeeDetails\":{\"payeeName\":\"paydetail\",\"payeeType\":\"visa\"},\"descriptions\":[\"success\"]}}"
}
}
{
"specversion": "1.0",
"id": "961ef004-cf14-4eed-9292-2feedf884143",
"source": "https://temenos.com/microservice/cloudevents/PaymentOrder",
"type": "CommandProcessed",
"datacontenttype": "application/json",
"subject": "commandprocessed",
"time": "2020-11-04T03:54:49.387Z",
"correlationid": "4216e8-3ca-9-b-8822",
"businesskey": "abc",
"sequenceno": 1,
"data": {
"commandId": "4216e8-3ca-9-b-8822",
"operationInstanceId": "opr",
"sequenceInstanceId": "seqinst",
"eventType": "PaymentOrder.CreateNewPaymentOrder",
"status": "NEW",
"businessObject": {
"status": 200,
"failureMessages": [],
"body": {
"paymentId": "PO~259977~5937~USD~124",
"status": "INITIATED",
"details": "refDe"
},
"success": true
},
"userId": "19000625884",
"commandSourceId": "https://temenos.com/microservice/cloudevents/ms-paymentorder"
}
}
{
"specversion": "1.0",
"id": "3f4b44c9-0623-4589-8fd4-ffcb312e5bc5",
"source": "https://temenos.com/microservice/cloudevents/PaymentOrder",
"type": "CommandFailed",
"datacontenttype": "application/json",
"subject": "commandfailed",
"time": "2020-11-04T04:29:09.975Z",
"correlationid": "4216e8-3ca-9-b-8823",
"businesskey": "abc",
"sequenceno": 1,
"data": {
"commandId": "4216e8-3ca-9-b-8823",
"operationInstanceId": "opr",
"sequenceInstanceId": "seqinst",
"eventType": "PaymentOrder.CreateNewPaymentOrder",
"status": "NEW",
"businessObject": {
"status": 400,
"failureMessages": [{
"message": "Record already exists",
"code": "MSF-002"
}],
"success": false
},
"userId": "19000625884",
"commandSourceId": "https://temenos.com/microservice/cloudevents/ms-paymentorder"
}
}
{
"specversion": "1.0",
"id": "d4ee2384-2fce-464d-9833-44e6e33b246f",
"source": "PaymentOrder",
"type": "POAccepted",
"datacontenttype": "application/json",
"subject": "event",
"extension-mscontext": "{}",
"businesskey": "abc",
"sequenceno": 1,
"correlationid": "4216e8-3ca-9-b-8817",
"data_base64": "eyJwYXltZW50T3JkZXJJZCI6IlBPfjI1OTk3Mn41OTM3flVTRH4xMjQiLCJkZWJpdEFjY291bnQiOiIyNTk5NzIiLCJjcmVkaXRBY2NvdW50IjoiNTkzNyIsImFtb3VudCI6MTI0LCJjdXJyZW5jeSI6IlVTRCJ9"
}
References
You can refer the following reference links for more information:
In this topic