Command examples

The examples below assume you are running from tools/detect-cli so the relative paths work directly.

Create one feed parser mapping

Command:

java -jar detect-cli.jar create-feed-parser-mapping -f "<path-to-resource-folder>/create_feed_parser_mapping.json"

Sample payload:

{
  "targetAttributeName": "customerName",
  "targetAttributeType": "String",
  "sourceField": "$.name",
  "description": "Customer name from Kafka message",
  "isRecordTimestamp": false
}

Expected console pattern:

Feed parser mapping created successfully with ID: <generatedId>

Bulk create feed parser mappings

Command:

java -jar detect-cli.jar create-feed-parser-mappings-bulk -f "<path-to-resource-folder>/create_feed_parser_mappings_bulk.json"

Sample payload:

{
  "feedParserMappings": [
    {
      "targetAttributeName": "amount",
      "targetAttributeType": "Double",
      "sourceField": "$.amount",
      "description": "Base amount from Kafka message",
      "profileId": null
    },
    {
      "targetAttributeName": "eventTime",
      "targetAttributeType": "DateTime",
      "sourceField": "$.eventTime",
      "sourceDataFormat": "yyyy-MM-dd HH:mm:ss",
      "description": "Record timestamp from Kafka message",
      "isRecordTimestamp": true,
      "profileId": null
    },
    {
      "targetAttributeName": "amountPlus10",
      "targetAttributeType": "Double",
      "valueTransformationRule": "amount+10",
      "description": "Derived amount based on existing target attribute",
      "profileId": null
    }
  ]
}

Expected console pattern:

Feed parser mappings bulk created successfully.
Get one feed parser mapping

Command:

java -jar detect-cli.jar get-feed-parser-mapping -id 201

Expected console pattern:

Feed Parser Mapping: <FeedParserMappingDto>

Get all feed parser mappings

Command:

java -jar detect-cli.jar get-all-feed-parser-mappings -feedApplicationId 3001 -search "amount" -page 0 -size 10

Expected console pattern:

Feed Parser Mappings: <PageResponse<FeedParserMappingDto>>

Update one feed parser mapping

Command:

java -jar detect-cli.jar update-feed-parser-mapping -id 201 -f "<path-to-resource-folder>/update_feed_parser_mapping.json"

Sample payload:

{
  "targetAttributeName": "amountPlus10",
  "targetAttributeType": "Double",
  "valueTransformationRule": "amount+10",
  "description": "Derived amount after update",
  "isRecordTimestamp": false,
  "profileId": null
}

Expected console pattern:

Feed parser mapping updated successfully with ID: 201

Bulk update feed parser mappings

Command:

java -jar detect-cli.jar update-feed-parser-mappings-bulk -f "<path-to-resource-folder>/update_feed_parser_mappings_bulk.json"

Sample payload:

{
  "feedParserMappings": [
    {
      "id": 201,
      "targetAttributeName": "customerCity",
      "targetAttributeType": "String",
      "sourceField": "$.address.city",
      "description": "City extracted from nested Kafka JSON",
      "isRecordTimestamp": false
    },
    {
      "id": 202,
      "targetAttributeName": "eventTime",
      "targetAttributeType": "DateTime",
      "sourceField": "$.eventTime",
      "sourceDataFormat": "yyyy-MM-dd HH:mm:ss",
      "description": "Updated event timestamp mapping",
      "isRecordTimestamp": true
    }
  ]
}

Expected console pattern:

Feed parser mappings bulk updated successfully.

Delete one feed parser mapping

Command:

java -jar detect-cli.jar delete-feed-parser-mapping -id 201

Expected console pattern:

Delete result: <ResponseBooleanWithMessageDto>

Delete all mappings for a feed application

Current command implementation example:

java -jar detect-cli.jar delete-all-feed-parser-mappings-by-feed-application -id 3001

Expected console pattern:

Delete all mappings result: <ResponseBooleanWithMessageDto>