Using the customer management plugin
The customer management plugin offers the possibility of retrieving customer details from an elasticSearch engine.
The plugin listens for incoming requests on a Kafka topic and sends the reply to the Engine on an outgoing topic.
ยปKafka topics for Customer ManagementKafka topics for customer managementโ
Customer Searchโ
info
The kafka topics used for the Customer Management plugin can be defined/overwritten using the following environment variables (that can be found in the deployment of the service):
KAFKA_TOPIC_CUSTOMER_SEARCH_IN
- used to search customers in the customer management pluginKAFKA_TOPIC_CUSTOMER_SEARCH_OUT
- used to get the response from the customer management plugin to the Engine.
The request sent to the plugin can use any key that was previously configured in the elaticsearch index where the customers are saved.
Example of an elastic search index:
{
"settings": {
"analysis": {
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"filter": ["lowercase"]
}
}
}
},
"mappings": {
"properties": {
"CIF":{
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"ClientUniqueIdentifier": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"CNPFlex":{
"type": "text"
},
"ClientType":{
"type": "text"
},
"ClientCategory":{
"type": "text"
},
"FirstName":{
"type": "text",
"fields": {
"keyword":{
"type": "keyword",
"normalizer": "lowercase_normalizer"
}
}
},
"LastName":{
"type": "text",
"fields": {
"keyword":{
"type": "keyword",
"normalizer": "lowercase_normalizer"
}
}
},
"CompanyName":{
"type": "text",
"fields": {
"keyword":{
"type": "keyword",
"normalizer": "lowercase_normalizer"
}
}
},
"DateOfBirth":{
"type": "date",
"format": "dd.MM.yyyy"
},
"IDDocType":{
"type": "text"
},
"IDSeries":{
"type": "text"
},
"IDNumber":{
"type": "text"
},
"IDIssueDate": {
"type": "date",
"format": "dd.MM.yyyy"
},
"IDExpiryDate":{
"type": "date",
"format": "dd.MM.yyyy"
},
"LegalForm":{
"type": "text"
},
"CreatedDatePJ":{
"type": "date",
"format": "dd.MM.yyyy"
},
"ClientClosedDate": {
"type": "date",
"format": "dd.MM.yyyy"
},
"LastModifiedDate":{
"type": "date",
"format": "dd.MM.yyyy"
},
"ListID":{
"type": "text"
},
"MobilePhone":{
"type": "text"
}
}
}
}
With this index configuration we can search for customers using any key:
Key examplesโ
Example 1 - using only the "ClientUniqueIdentifier" key:โ
{
"ClientUniqueIdentifier": "1900101223344"
}
Example 2 - using "FirstName" and "LastName" keys:โ
{
"FirstName": "TestFirstName",
"LastName": "Test Last Name"
}
Example 3 - using "FirstName", "DateOfBirth" and "LegalForm" keys:โ
{
"FirstName": "TestFirstName",
"DateOfBirth": "01.01.1990",
"LegalForm": "PF"
}
Keys descriptionโ
- customers - list of customers found in the customer management, in the used elasticsearch index, maximum 10 results
- hasMore - boolean, true if number of results are bigger than 10, false if the number of results are equal or smaller than 10
- error - error description if the request returned an error
Topic name example:
ro.flowx.updates.sandbox.customer.management.response
Sent body example:
"searchResults" : {
"customers" : [ {
"id" : "CL12345",
"firstName" : "John Doe",
"lastName" : "Doe",
"birthDate" : "27.02.1982",
"cui" : "1820227103865_84",
"companyName" : "",
"clientCategory" : "PF",
"clientType" : "PF",
"idSeries" : "RT",
"idNumber" : "879948",
"idDocType" : "CI",
"idExpiryDate" : "27.02.2023",
"legalForm" : "",
"listId" : "4691602",
"mobilePhone" : "0711111111",
"attributes" : null,
"type" : "PF"}],
"hasMore" : false,
"error" : null
}