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 Management

Kafka topics for customer management

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 plugin
  • KAFKA_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 Elasticsearch index where the customers are saved.

Example of an Elasticsearch 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
  }