CEP 5.4.3, not triggering basic condition - fiware

using CEP i'm trying to make a basic example of communication between Proton and Orion.
I simply want Proton to receive a notification of temperature from Orion and send back a payload changing one boolean attribute if the temperature value is superior or equal to 20.
Here is the definition i'm using.
{
"epn":
{
"events":
[
{
"name": "TemperatureContextUpdate",
"attributes":
[
{
"dimension": 0,
"description": "The certainty that this event happen (value between 0 to 1)",
"name": "Certainty",
"defaultValue": "1",
"type": "Double"
},
{
"dimension": 0,
"description": "No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters",
"name": "OccurrenceTime",
"type": "Date"
},
{
"dimension": 0,
"name": "ExpirationTime",
"type": "Date"
},
{
"dimension": 0,
"description": "The cost of this event occurrence. Negative if this is an opportunity",
"name": "Cost",
"type": "Double"
},
{
"dimension": 0,
"description": "Used in case the this event occur within an interval",
"name": "Duration",
"defaultValue": "0",
"type": "Double"
},
{
"dimension": "0",
"name": "entityId",
"type": "String"
},
{
"dimension": "0",
"name": "entityType",
"type": "String"
},
{
"dimension": "0",
"name": "temperature",
"type": "Integer"
},
{
"dimension": "0",
"name": "chaud",
"type": "Boolean"
}
],
"createdDate": "Wed Feb 22 2017"
},
{
"name": "Out_TemperatureContextUpdate",
"attributes":
[
{
"dimension": 0,
"description": "The certainty that this event happen (value between 0 to 1)",
"name": "Certainty",
"defaultValue": "1",
"type": "Double"
},
{
"dimension": 0,
"description": "No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters",
"name": "OccurrenceTime",
"type": "Date"
},
{
"dimension": 0,
"name": "ExpirationTime",
"type": "Date"
},
{
"dimension": 0,
"description": "The cost of this event occurrence. Negative if this is an opportunity",
"name": "Cost",
"type": "Double"
},
{
"dimension": 0,
"description": "Used in case the this event occur within an interval",
"name": "Duration",
"defaultValue": "0",
"type": "Double"
},
{
"dimension": "0",
"name": "entityId",
"type": "String"
},
{
"dimension": "0",
"name": "entityType",
"type": "String"
},
{
"dimension": "0",
"name": "temperature",
"type": "Integer"
},
{
"dimension": "0",
"name": "chaud",
"type": "Boolean"
}
],
"createdDate": "Wed Feb 22 2017"
}
],
"name": "TemperatureDemo",
"consumers":
[
{
"events":
[
{
"name": "Out_TemperatureContextUpdate"
}
],
"name": "Consumer_Rest",
"properties":
[
{
"name": "URL",
"value": "http://172.17.0.3:1026/v2/entities"
},
{
"name": "contentType",
"value": "application/json"
},
{
"name": "formatter",
"value": "json_ngsi"
},
{
"name": "delimiter",
"value": ";"
},
{
"name": "tagDataSeparator",
"value": "="
},
{
"name": "dateFormat",
"value": "dd/MM/yyyy-HH:mm:ss"
}
],
"type": "Rest",
"createdDate": "Wed Feb 22 2017"
},
{
"events":
[
{
"name": "TemperatureContextUpdate"
}
],
"name": "Consumer_File",
"properties":
[
{
"name": "filename",
"value": "/home/work/Documents/test.txt"
},
{
"name": "formatter",
"value": "json"
},
{
"name": "delimiter",
"value": ";"
},
{
"name": "tagDataSeparator",
"value": "="
}
],
"type": "File",
"createdDate": "Wed Feb 22 2017"
}
],
"epas":
[
{
"inputEvents":
[
{
"instanceSelectionPolicy": "First",
"alias": "TemperatureContextUpdate",
"filterExpression": "TemperatureContextUpdate.temperature>=20",
"name": "TemperatureContextUpdate",
"consumptionPolicy": "Consume"
}
],
"derivedEvents":
[
{
"name": "Out_TemperatureContextUpdate",
"reportParticipants": false,
"expressions":
{
"Cost": "TemperatureContextUpdate.Cost",
"Certainty": "TemperatureContextUpdate.Certainty",
"OccurrenceTime": "TemperatureContextUpdate.OccurrenceTime",
"Duration": "TemperatureContextUpdate.Duration",
"entityId": "TemperatureContextUpdate.entityId",
"ExpirationTime": "TemperatureContextUpdate.ExpirationTime",
"chaud": "true",
"entityType": "TemperatureContextUpdate.entityType",
"temperature": "TemperatureContextUpdate.temperature"
}
}
],
"evaluationPolicy": "Immediate",
"name": "EPA_Change",
"internalSegmentation":
[
],
"context": "always",
"epaType": "Basic",
"cardinalityPolicy": "Single",
"localPlacement": true,
"createdDate": "Wed Feb 22 2017",
"computedVariables":
[
]
}
],
"optimization":
{
},
"contexts":
{
"temporal":
[
{
"terminators":
[
],
"neverEnding": true,
"atStartup": true,
"name": "always",
"type": "TemporalInterval",
"createdDate": "Wed Feb 22 2017",
"initiators":
[
]
}
],
"segmentation":
[
],
"composite":
[
]
},
"producers":
[
]
}
}
I try to create a file while first update is receive but this file is always empty, btw it is correctly create in my directory and change everytime I change definition. The rest payload is never send like the condition is never triggered.
The payload I send :
{
"subscriptionId": "51c04a21d714fb3b37d7d5a7",
"data":
[ {
"id": "temp1",
"type": "Temperature",
"temperature": {
"type":"integer",
"value": 28,
"metadata":{}
},
"chaud": {
"type":"boolean",
"value": false,
"metadata":{}
},
"Certainty": {
"value": "1",
"type": "Float"
},
"Cost": {
"value": "0",
"type": "Float"
},
"Name": {
"value": "",
"type": "String"
},
"EventSource": {
"value": "",
"type": "String"
},
"Duration": {
"value": "0",
"type": "Float"
}
}
]
}
The log catalina.out :
INFOS: started event message body reader
févr. 23, 2017 11:23:35 AM com.ibm.hrl.proton.webapp.providers.EventJSONNgsiMessageReader parseVTwoFormat
INFOS: Event: TemperatureContextUpdate
févr. 23, 2017 11:23:35 AM com.ibm.hrl.proton.webapp.providers.EventJSONNgsiMessageReader readFrom
INFOS: finished event message body reader
févr. 23, 2017 11:23:35 AM com.ibm.hrl.proton.webapp.providers.EventJSONNgsiMessageReader readFrom
INFOS: EventJSONNgsiMessageReader: read event TemperatureContextUpdate; entityId=temp1; EventId=ba868559-7589-4720-ab75-658b920a3f14; chaud=false; entityType=Temperature; Chronon=null; temperature=28; DetectionTime=1487845415319; Name=; Certainty=1; Cost=0; EventSource=; OccurrenceTime=null; Duration=0; Annotation=; ExpirationTime=null; from broker...
févr. 23, 2017 11:23:35 AM com.ibm.hrl.proton.webapp.resources.EventResource submitNewEvent
INFOS: starting submitNewEvent
févr. 23, 2017 11:23:35 AM com.ibm.hrl.proton.webapp.resources.EventResource submitNewEvent
INFOS: events sent to proton runtime...
So any idea where is my problem ?
Thanks.

your mistake is that you send an event with an empty name.
I am sorry the same information is duplicated in the input, however this steams from the integration between Proton and Orion, each of which requires the information in different form and the difference was not patched smoothly.
The input you should send should contain the input event name, like this :
{
"subscriptionId": "51c04a21d714fb3b37d7d5a7",
"data":
[ {
"id": "temp1",
"type": "Temperature",
"temperature": {
"type":"integer",
"value": "28",
"metadata":{}
},
"chaud": {
"type":"boolean",
"value": false,
"metadata":{}
},
"Certainty": {
"value": "1",
"type": "Float"
},
"Cost": {
"value": "0",
"type": "Float"
},
"Name": {
"value": "TemperatureContextUpdate",
"type": "String"
},
"EventSource": {
"value": "",
"type": "String"
},
"Duration": {
"value": "0",
"type": "Float"
}
}
]
}
Note that the name attribute now has value "TemperatureContextUpdate"

Related

JSON Parsing a Plain Text File

I have a lot of data I need to parse though.
I need to pull all pid's and price's.
`
[
{
"id": 159817,
"price": "10.69",
"stocked": true,
"store": {
"id": 809,
"nsn": "22036-0",
"pricingSource": "manual",
"lastUpdated": "2022-12-05T15:24:33.908Z"
},
"sharedFields": {
"type": "PRODUCT",
"id": 24549,
"pid": "12079",
"labels": [
{
"type": "default",
"value": "Chicken Sandwich",
"locale": "en"
},
{
"type": "fresh",
"value": "Chicken",
"locale": "en"
},
{
"type": "product_json",
"value": "Chicken",
"locale": "en"
}
],
"calMin": 600,
"calMax": 600,
"lastUpdated": "2021-12-31T13:49:22.794Z"
}
},
{
"id": 159818,
"price": "9.29",
"stocked": true,
"store": {
"id": 809,
"nsn": "22036-0",
"pricingSource": "manual",
"lastUpdated": "2022-12-05T15:24:33.908Z"
},
"sharedFields": {
"type": "PRODUCT",
"id": 25,
"pid": "1",
"labels": [
{
"type": "default",
"value": "Ham Sandwich",
"locale": "en"
},
{
"type": "fresh",
"value": "Ham",
"locale": "en"
}
],
"calMin": 540,
"calMax": 540,
"lastUpdated": "2021-07-09T19:30:00.326Z"
}
}
]
`
and I need to place them into a string like this, but on a scale of 150 products. I'd also need to change "pid" to "productId"
[{ "productId": "46238", "price": 6.09 }, { "productId": "40240", "price": 1.49 }]
I need to add a string before this data, but I'm pretty confident I can figure that part out.
I am pretty open to the easiest suggestion, whether that be VBS, Excel macro, etc.

Metadata converter?

Im currently working on a generated collection and got a huge metadata file. Its build up like this:
[
{
"name": "amongnfts #1",
"description": "This is one member of the AmongNFT collection. It's unique and only exists once, but may be a bit cooler than the others.",
"image": "/1.png",
"dna": "055b93fd187e52f85e3ea8b0ad660fa51aaea9e0",
"edition": 1,
"date": 1645368881553,
"attributes": [
{
"trait_type": "background",
"value": "blue"
},
{
"trait_type": "body",
"value": "pink"
},
{
"trait_type": "clothing",
"value": "teamred"
},
{
"trait_type": "hat",
"value": "pilot"
},
{
"trait_type": "visor",
"value": "krieghaus"
},
{
"trait_type": "pet",
"value": "minimateorange"
}
],
"compiler": "HashLips Art Engine"
},
{
"name": "amongnfts #2",
"description": "This is one member of the AmongNFT collection. It's unique and only exists once, but may be a bit cooler than the others.",
"image": "/2.png",
"dna": "a05e9acf4665b9e9e5adbcb9dfc33df255e2e58f",
"edition": 2,
"date": 1645368883622,
"attributes": [
{
"trait_type": "background",
"value": "orange"
},
{
"trait_type": "body",
"value": "white"
},
{
"trait_type": "clothing",
"value": "elf"
},
{
"trait_type": "hat",
"value": "wethair"
},
{
"trait_type": "visor",
"value": "none"
},
{
"trait_type": "pet",
"value": "minimatetan"
}
],
"compiler": "HashLips Art Engine"
},
]
(Goes down for 10.000 editions so thats why I dont do it manually.)
But it should look like this:
{
"nft": [
{
"file_path": "/1.png",
"nft_name": "amongnfts #1",
"external_link": "",
"description": "This is one member of the AmongNFT collection. It's unique and only exists once, but may be a bit cooler than the others.",
"collection": "AmongNFTs",
"properties": [
{
"type": "background",
"name": "blue"
},
{
"type": "body",
"name": "pink"
},
{
"type": "clothing",
"name": "teamred"
},
{
"type": "hat",
"name": "pilot"
},
{
"type": "visor",
"name": "krieghaus"
},
{
"type": "pet",
"name": "minimateorange"
},
],
"levels": "",
"stats": "",
"unlockable_content": "",
"explicit_and_sensitive_content": "",
"supply": "1",
"blockchain": "Polygon",
"sale_type": "",
"price": 0.001,
"method": "",
"duration": "",
"specific_buyer": "",
"quantity": ""
}
]
}
Is there an easy way of converting them automatically and if so, how would the code look like?
The metadata.json file is here.

JSON Schema validation is not working

I have a json response like below. In the views array may or may not contain actions array.
In the reponse If any of view array contains actions object , then i have to validate that actions data with json schema(schema1.json)
And in the schema i mentioned the action propertes like(type,label,localizedlabel) as required ones.
But when I modify key or value type of this type,label,localizedlabel in the response does not output any errors.
Tested via( https://www.jsonschemavalidator.net/). what wrong with my schema?
How can i validate actions object only whenever it present inside any of view array?
schema1.json
{
"$id": "",
"type": "array",
"items": {
"$id": "/items",
"type": "object",
"properties": {
"name": {
"$id": "/items/properties/name",
"type": "string",
"title": "The Name Schema ",
"default": "",
"examples": [
"Preview"
]
},
"displayOrder": {
"$id": "/items/properties/displayOrder",
"type": "integer",
"title": "The Displayorder Schema ",
"default": 0,
"examples": [
1
]
},
"actions": {
"$id": "/items/properties/actions",
"type": "array",
"items": {
"$id": "/items/properties/actions/items",
"type": "object",
"properties": {
"type": {
"$id": "/items/properties/actions/items/properties/type",
"type": "string",
"title": "The Type Schema ",
"default": "",
"examples": [
"watch"
]
},
"label": {
"$id": "/items/properties/actions/items/properties/label",
"type": "string",
"title": "The Label Schema ",
"default": "",
"examples": [
"Watch"
]
},
"localizedLabel": {
"$id": "/items/properties/actions/items/properties/localizedLabel",
"type": "object",
"properties": {
"ENG": {
"$id": "/items/properties/actions/items/properties/localizedLabel/properties/ENG",
"type": "string",
"title": "The Eng Schema ",
"default": "",
"examples": [
"Watch"
]
},
"ESP": {
"$id": "/items/properties/actions/items/properties/localizedLabel/properties/ESP",
"type": "string",
"title": "The Esp Schema ",
"default": "",
"examples": [
"Ver"
]
}
}
}
},
"required": [
"type",
"label",
"localizedLabel"
]
}
},
"localizedName": {
"$id": "/items/properties/localizedName",
"type": "object",
"properties": {
"ENG": {
"$id": "/items/properties/localizedName/properties/ENG",
"type": "string",
"title": "The Eng Schema ",
"default": "",
"examples": [
"Preview"
]
},
"ESP": {
"$id": "/items/properties/localizedName/properties/ESP",
"type": "string",
"title": "The Esp Schema ",
"default": "",
"examples": [
"Adelanto"
]
}
}
}
},
"required": [
"actions"
]
}
}
response json
[{
"season": 2017,
"teamData": {
"awayTeam": {
"id": 6,
"city": "Dallas",
"name": "Mavericks",
"abbr": "DAL",
"color": "#0B51A1"
},
"homeTeam": {
"id": 8,
"city": "Detroit",
"name": "Pistons",
"abbr": "DET",
"color": "#990300"
}
},
"views": [{
"name": "Preview",
"displayOrder": 1,
"groups": [{
"type": "static",
"displayOrder": 1,
"tiles": [{
"context": "event",
"collection": "event",
"auditType": "pregame-preview",
"displayOrder": 1,
"_id": "5ac58ea21ee2112b33291f1c",
"eventId": 2018040608,
"dimensions": {
"width": 372,
"height": 375
},
"tileId": "36b154e719d7d8397da487cbc4e5f7d1",
"renderTime": "2018-04-05T02:49:05+00:00",
"dataTime": "2018-04-05T02:48:58+00:00",
"dataStamp": 1522896538,
"location": "http://test.com/2018040608/static/pre-event/pregame-preview/1522896538.png",
"tile_type": "static"
}
]
}
],
"actions": [{
"type": "watch",
"label": "Watch",
"localizedLabel": {
"ENG": "Watch",
"ESP": "Ver"
}
}, {
"type": "record",
"label": "Record",
"localizedLabel": {
"ENG": "Record",
"ESP": "Grabar"
}
}, {
"type": "tile_overlay",
"label": "Current Standings",
"tili": {
"context": "event",
"collection": "event",
"auditType": "full-standings",
"_id": "5ac6f9de2ccaf768d092c918",
"eventId": 2018040608,
"dimensions": {
"width": 1140,
"height": 660
},
"tileId": "852f92537e68dc99b54f1228459ec9ef",
"renderTime": "2018-04-06T04:38:54+00:00",
"dataTime": "2018-04-06T04:38:52+00:00",
"dataStamp": 1522989532,
"location": "http://test.com/2018040608/static/pre-event/full-standings/1522989532.png"
},
"localizedLabel": {
"ENG": "Current Standings",
"ESP": "Posición actual"
}
}, {
"type": "favorite",
"label": "Favorite",
"localizedLabel": {
"ENG": "Favorite",
"ESP": "Favorito"
}
}
],
"localizedName": {
"ENG": "Preview",
"ESP": "Adelanto"
}
}, {
"name": "Team Stats",
"displayOrder": 2,
"groups": [{
"type": "static",
"displayOrder": 1,
"tiles": [{
"context": "event",
"collection": "event",
"auditType": "pregame-team_stats",
"displayOrder": 1,
"_id": "5ac6755a4f82eb58a5eae6a6",
"eventId": 2018040608,
"dimensions": {
"width": 372,
"height": 510
},
"tileId": "1302dc16c9fe68c3e6edadd98afce2bc",
"renderTime": "2018-04-05T19:13:30+00:00",
"dataTime": "2018-04-05T19:13:28+00:00",
"dataStamp": 1522955608,
"location": "http://test.com/2018040608/static/pre-event/pregame-team_stats/1522955608.png",
"tile_type": "static"
}
]
}
],
"localizedName": {
"ENG": "Team Stats",
"ESP": "Estadísticas del equipo"
}
}, {
"name": "Leaders",
"displayOrder": 3,
"groups": [{
"type": "static",
"displayOrder": 1,
"tiles": [{
"context": "event",
"collection": "event",
"auditType": "pregame-leaders",
"displayOrder": 1,
"_id": "5ac26eb31ee2112b3328b00c",
"eventId": 2018040608,
"dimensions": {
"width": 372,
"height": 510
},
"tileId": "96abc24c47d61327426ef2b24281acbf",
"renderTime": "2018-04-02T17:55:57+00:00",
"dataTime": "2018-04-02T17:55:54+00:00",
"dataStamp": 1522691754,
"location": "http://test.com/2018040608/static/pre-event/pregame-leaders/1522691754.png",
"tile_type": "static"
}
]
}
],
"localizedName": {
"ENG": "Leaders",
"ESP": "Líderes"
}
}
]
}
]
There's nothing wrong with your schema. It should do what you need if used properly. Because it only describes the "views" part of the schema you would need to iterate through your response and pass just the "views" part of each item to the validator one at a time.
Or, you could add enough of the response structure to the schema to validate everything at once. Then you could just pass your whole response to the validator.
{
"type": "array",
"items": {
"type": "object",
"properties": {
"views": { "$ref": "schema1.json" }
}
}
}

Use of ResultTemplate in vsts extension tasks

I created a task that talks to a REST API to retreive the values for 2 picklists.
Filling the first dropdown box works fine, when using just the jsonpath.
Based on the first picklist I'd like to retreive values of the second list.
I've tried some variations and I'm trying something like this:
The json which I receive in the first rest call is similar to:
{
"id": "45",
"href": "https://selfservice/api/configurations/45/",
"name": "Type",
"description": "",
"version": "0.0.4",
"attributes": [
{
"value": {
"sdk-object": {
"type": "ConfigurationElement",
"id": "56"
}
},
"type": "ConfigurationElement",
"name": "win"
},
{
"value": {
"sdk-object": {
"type": "ConfigurationElement",
"id": "57"
}
},
"type": "ConfigurationElement",
"name": "lin"
}
]
}
I try to show the attributes name in the list and need the id of the attribute in the second picklist.
I created the following datasourcebindings in the task.json. Of course, the targets exist in the task.
task.json:
{
"id": "GUID",
"name": "Spinup",
"friendlyName": "Create environment",
"description": "Starts Workflow to create an environment. ___ The following placeholders are created deplending on the template and can be used in the rest of the release:**XLDEnvironment** and **testAgentHostname**",
"category": "Deploy",
"author": "***",
"version": {
"Major": 0,
"Minor": 0,
"Patch": 33
},
"minimumAgentVersion": "1.95.3",
"inputs": [
{
"label": "Endpoint",
"name": "connectedServiceName",
"required": true,
"type": "connectedService:server",
"helpMarkDown": "endpoint to connect to."
},
{
"name": "stage",
"type": "string",
"label": "Stage",
"defaultValue": "$(Release.EnvironmentName)",
"required": true,
"helpMarkDown": "Stage of the release, default value is based on the pipeline."
},
{
"name": "releaseName",
"type": "string",
"label": "Environment name",
"defaultValue": "$(Release.ReleaseName)",
"required": true,
"helpMarkDown": "Name of the environment that will be created."
},
{
"name": "owner",
"type": "string",
"label": "Owner of the environment",
"defaultValue": "***",
"required": true,
"helpMarkDown": "It is common to use the initials of the product owner in this field. There has to be a valid AD user owner of each environment. This can also be set by using a variable through the pipeline."
},
{
"name": "group",
"type": "string",
"label": "Group of the owner",
"defaultValue": "",
"required": true,
"helpMarkDown": "group that owns the environment. groups can be requested by the infrastructure department. Example: ****"
},
{
"name": "platform",
"type": "pickList",
"label": "Platform (OS)",
"defaultValue": "",
"required": true,
"helpMarkDown": "Choose the type of the target platform."
},
{
"name": "size",
"type": "pickList",
"label": "Environment Template",
"defaultValue": "",
"required": true,
"helpMarkDown": "Size of the environment to create."
}
],
"dataSourceBindings": [
{
"dataSourceName": "GetCEPlatformType",
"endpointId": "$(connectedServiceName)",
"target": "platform",
"selector": "jsonpath:$.attributes[*].name",
"keySelector": "jsonpath:$.attributes[*].value.sdk-object.id"
},
{
"dataSourceName": "GetCEPlatformSize",
"endpointId": "$(connectedServiceName)",
"target": "size",
"parameters": {
"platformTypeId": "$(platform)"
}
}
],
"instanceNameFormat": "Spin up $(size) $(platform) environment",
"execution": {
"PowerShell3": {
"target": "$(currentDirectory)\\task.ps1",
"argumentFormat": "",
"workingDirectory": "$(currentDirectory)"
}
}
}
vss-extension.json:
{
"manifestVersion": 1,
"id": "*****",
"name": "Release Tasks",
"version": "1.0.1",
"publisher": "***",
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"description": "Tools to contact ***. Includes a task to spin up a platform and a task to remove the platform.",
"categories": [
"Build and release"
],
"icons": {
"default": "images/extension-icon.png"
},
"files": [
{
"path": "RemoveEnvironment"
},
{
"path": "SpinUpEnvironment"
}
],
"contributions": [
{
"id": "******",
"type": "ms.vss-distributed-task.task",
"targets": [
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "RemoveEnvironment"
}
},
{
"id": "*********",
"type": "ms.vss-distributed-task.task",
"targets": [
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "SpinUpEnvironment"
}
},
{
"description": "Service Endpoint type for all connections",
"id": "endpoint-type",
"properties": {
"authenticationSchemes": [
{
"inputDescriptors": [
{
"description": "Username",
"id": "username",
"inputMode": "textbox",
"name": "Username",
"validation": {
"dataType": "string",
"isRequired": true
}
},
{
"description": "Password",
"id": "password",
"inputMode": "passwordbox",
"isConfidential": true,
"name": "Password",
"validation": {
"dataType": "string",
"isRequired": false
}
}
],
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic"
}
],
"dataSources": [
{
"endpointUrl": "api/configurations/*****/",
"name": "GetCEPlatformType",
"resultSelector": "jsonpath:$.attributes[*].name"
},
{
"endpointUrl": "api/configurations/$(platformTypeId)/",
"name": "GetCEPlatformSize",
"resultSelector": "jsonpath:$.attributes[*].name"
}
],
"displayName": "*****",
"helpMarkDown": "Enter the url and credentials to connect to the endpoint.",
"name": "server",
"url": {
"displayName": "Server URL",
"helpText": "Url for the server to connect to."
}
},
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"type": "ms.vss-endpoint.service-endpoint-type"
}
]
}
Sadly I can't get this to work. The datasources exist in the endpoint, but I'm not sure what to do with the resultSelector.
Does anyone have an idea on how to get this to work? The documentation on this isn't too good.
I'm not familiar with mustache, but in the mustache test tool this seems to work.
Thoughts are appreciated!
Try with this in the first data source:
{
"dataSourceName": "dsList1",
"endpointId": "$(connectedServiceName)",
"target": "list1",
"selector": "jsonpath:$.attributes[*].name",
"keySelector": "jsonpath:$.attributes[*].value.sdk-object.id"
}
Update:
You were trying to use "platformTypeId" in vss-extension.json file while it was defined in task.json, this cause the error message you mentioned in the comment.
By the way, I just noticed that you are using "dataSourceBindings", then you cannot use "selector" and "KeySelector" to parse the result since they are used for "sourceDefinitions".
To achieve the feature you want with "dataSourceBindings", you can definition the endpoint url in the task.json directly instead of defining datasource in endpoint contribution.
So you can move the datasources section in the vss-extension.json file first, and then in the task.json file, change to following:
"dataSourceBindings": [
{
"endpointId": "$(connectedServiceName)",
"endpointURL": "api/configurations/*****/",
"target": "platform",
"resultselector": "jsonpath:$.attributes[*]",
"resultTemplate": "{ \"Value\" : \"{{{value.id}}}\", \"DisplayValue\" : \"{{{name}}}\" }"
},
{
"endpointId": "$(connectedServiceName)",
"endpointURL": "api/configurations/$(platformTypeId)/",
"target": "size"
}
],

Proton CEP Absence EPA not triggered

I am unable to get ProtonCEP to create an event based on an absence rule.
The EPA "MissingQueueDataRule" is supposed to create an event "MissingQueueData" in the case that no events of type "QueueContextUpdate" (the entityID of the event is not important) are received in a past time interval (30 seconds).
There are no visible errors in the logs.
{
"epn": {
"events": [
{
"name": "Device",
"createdDate": "Thu Nov 12 2015",
"attributes": [
{
"name": "datacount5",
"type": "Integer",
"dimension": 0,
"description": "The certainty that this event happen (value between 0 to 1)"
}
]
},
{
"name": "Queue",
"createdDate": "Thu Nov 12 2015",
"attributes": [
{
"name": "name",
"type": "String",
"dimension": "0"
},
{
"name": "volume",
"type": "Integer",
"dimension": "0"
}
]
},
{
"name": "DeviceContextUpdate",
"createdDate": "Thu Nov 12 2015",
"attributes": [
{
"name": "datacount5m",
"type": "Integer",
"dimension": 0,
"description": "The certainty that this event happen (value between 0 to 1)"
},
{
"name": "entityId",
"type": "String",
"dimension": "0"
},
{
"name": "entityType",
"type": "String",
"dimension": "0"
},
{
"name": "lastupdate",
"type": "Date",
"dimension": "0"
},
{
"name": "activationdate",
"type": "Date",
"dimension": "0"
},
{
"name": "efficiencyratio",
"type": "Double",
"dimension": "0"
}
]
},
{
"name": "QueueContextUpdate",
"createdDate": "Thu Nov 12 2015",
"attributes": [
{
"name": "volume",
"type": "Integer",
"dimension": "0"
},
{
"name": "entityId",
"type": "String",
"dimension": "0"
},
{
"name": "entityType",
"type": "String",
"dimension": "0"
}
]
},
{
"name": "QueueVolumeHigh",
"createdDate": "Wed Jan 27 2016",
"attributes": [
{
"name": "Certainty",
"type": "Double",
"defaultValue": "1",
"dimension": 0,
"description": "The certainty that this event happen (value between 0 to 1)"
},
{
"name": "OccurrenceTime",
"type": "Date",
"dimension": 0,
"description": "No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters"
},
{
"name": "ExpirationTime",
"type": "Date",
"dimension": 0
},
{
"name": "Cost",
"type": "Double",
"dimension": 0,
"description": "The cost of this event occurrence. Negative if this is an opportunity"
},
{
"name": "Duration",
"type": "Double",
"defaultValue": "0",
"dimension": 0,
"description": "Used in case the this event occur within an interval"
},
{
"name": "AffectedEntity",
"type": "String",
"dimension": "0"
},
{
"name": "AffectedEntityType",
"type": "String",
"dimension": "0"
},
{
"name": "EventType",
"type": "String",
"dimension": "0"
},
{
"name": "EventSeverity",
"type": "String",
"dimension": "0"
},
{
"name": "AffectedEntityVolume",
"type": "Integer",
"dimension": "0"
}
]
},
{
"name": "MissingQueueData",
"createdDate": "Wed Jan 27 2016",
"attributes": [
{
"name": "Certainty",
"type": "Double",
"defaultValue": "1",
"dimension": 0,
"description": "The certainty that this event happen (value between 0 to 1)"
},
{
"name": "OccurrenceTime",
"type": "Date",
"dimension": 0,
"description": "No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters"
},
{
"name": "ExpirationTime",
"type": "Date",
"dimension": 0
},
{
"name": "Cost",
"type": "Double",
"dimension": 0,
"description": "The cost of this event occurrence. Negative if this is an opportunity"
},
{
"name": "Duration",
"type": "Double",
"defaultValue": "0",
"dimension": 0,
"description": "Used in case the this event occur within an interval"
},
{
"name": "EventSeverity",
"type": "String",
"defaultValue": "\"Warning\"",
"dimension": "0"
}
]
}
],
"epas": [
{
"name": "CriticalQueueVolumeRule",
"description": "Emit a QueueVolumeHigh with Severity=Critical if any Queue volume > 1000",
"createdDate": "Wed Jan 27 2016",
"createdBy": "Pedro",
"epaType": "All",
"context": "CriticalQueueVolumeComb",
"inputEvents": [
{
"name": "QueueContextUpdate",
"filterExpression": "QueueContextUpdate.volume>1000",
"consumptionPolicy": "Consume",
"instanceSelectionPolicy": "First"
}
],
"computedVariables": [],
"evaluationPolicy": "Immediate",
"cardinalityPolicy": "Single",
"internalSegmentation": [],
"derivedEvents": [
{
"name": "QueueVolumeHigh",
"reportParticipants": false,
"expressions": {
"OccurrenceTime": "QueueContextUpdate.DetectionTime",
"Duration": "0",
"AffectedEntity": "QueueContextUpdate.entityId",
"AffectedEntityType": "QueueContextUpdate.entityType",
"EventType": "\"QueueVolumeHigh\"",
"EventSeverity": "\"Critical\"",
"AffectedEntityVolume": "QueueContextUpdate.volume"
}
}
]
},
{
"name": "MissingQueueDataRule",
"description": "Detect when the scripts stop working and sending queue data",
"createdDate": "Wed Jan 27 2016",
"epaType": "Absence",
"context": "MissingQueueDataWindow",
"inputEvents": [
{
"name": "QueueContextUpdate",
"alias": "Q1",
"consumptionPolicy": "Consume",
"instanceSelectionPolicy": "First"
}
],
"computedVariables": [],
"evaluationPolicy": "Deferred",
"cardinalityPolicy": "Single",
"internalSegmentation": [],
"derivedEvents": [
{
"name": "MissingQueueData",
"reportParticipants": false,
"expressions": {
"Certainty": "1.0",
"Duration": "0",
"EventSeverity": "\"Warning\""
}
}
]
}
],
"contexts": {
"temporal": [
{
"name": "Always",
"createdDate": "Wed Jan 27 2016",
"type": "TemporalInterval",
"atStartup": true,
"neverEnding": true,
"initiators": [],
"terminators": []
},
{
"name": "CriticalQueueVolumeWindow",
"description": "Start when queue volume > 1000, ends in 30seconds",
"createdDate": "Wed Jan 27 2016",
"createdBy": "Pedro",
"type": "TemporalInterval",
"atStartup": false,
"neverEnding": false,
"initiators": [
{
"initiatorType": "Event",
"initiatorPolicy": "Ignore",
"name": "QueueContextUpdate",
"condition": "QueueContextUpdate.volume>1000"
}
],
"terminators": [
{
"terminatorType": "Event",
"terminatorPolicy": "First",
"terminationType": "Terminate",
"name": "QueueContextUpdate",
"condition": " QueueContextUpdate.volume<500"
},
{
"terminatorType": "RelativeTime",
"terminationType": "Terminate",
"relativeTime": "300000"
}
]
},
{
"name": "MissingQueueDataWindow",
"createdDate": "Wed Jan 27 2016",
"type": "TemporalInterval",
"atStartup": false,
"neverEnding": false,
"initiators": [
{
"initiatorType": "Event",
"initiatorPolicy": "Add",
"name": "QueueContextUpdate"
}
],
"terminators": [
{
"terminatorType": "RelativeTime",
"terminationType": "Terminate",
"relativeTime": "10000"
}
]
}
],
"segmentation": [
{
"name": "QueueID",
"description": "Treat objects as distinct based on entityID",
"createdDate": "Wed Jan 27 2016",
"createdBy": "Pedro",
"participantEvents": [
{
"name": "QueueContextUpdate",
"expression": "QueueContextUpdate.entityId"
},
{
"name": "QueueVolumeHigh",
"expression": "QueueVolumeHigh.AffectedEntity"
}
]
}
],
"composite": [
{
"name": "CriticalQueueVolumeComb",
"createdDate": "Wed Jan 27 2016",
"temporalContexts": [
{
"name": "CriticalQueueVolumeWindow"
}
],
"segmentationContexts": [
{
"name": "QueueID"
}
]
}
]
},
"consumers": [
{
"name": "DeviceReport",
"createdDate": "Thu Nov 12 2015",
"type": "File",
"properties": [
{
"name": "filename",
"value": "/usr/share/tomcat/webapps/sample/SentinelMonitor_DeviceReport.txt"
},
{
"name": "formatter",
"value": "json"
},
{
"name": "delimiter",
"value": ";"
},
{
"name": "tagDataSeparator",
"value": "="
},
{
"name": "SendingDelay",
"value": "1000"
}
],
"events": [
{
"name": "Device"
}
]
},
{
"name": "QueueReport",
"createdDate": "Thu Nov 12 2015",
"type": "File",
"properties": [
{
"name": "filename",
"value": "/usr/share/tomcat/webapps/sample/SentinelMonitor_QueueReport.txt"
},
{
"name": "formatter",
"value": "json"
},
{
"name": "delimiter",
"value": ";"
},
{
"name": "tagDataSeparator",
"value": "="
},
{
"name": "SendingDelay",
"value": "1000"
}
],
"events": [
{
"name": "Queue"
}
]
},
{
"name": "DeviceContextUpdateReport",
"createdDate": "Thu Nov 12 2015",
"type": "File",
"properties": [
{
"name": "filename",
"value": "/usr/share/tomcat/webapps/sample/SentinelMonitor_DeviceContextUpdateReport.txt"
},
{
"name": "formatter",
"value": "json"
},
{
"name": "delimiter",
"value": ";"
},
{
"name": "tagDataSeparator",
"value": "="
},
{
"name": "SendingDelay",
"value": "1000"
}
],
"events": [
{
"name": "DeviceContextUpdate"
}
]
},
{
"name": "QueueContextUpdateReport",
"createdDate": "Thu Nov 12 2015",
"type": "File",
"properties": [
{
"name": "filename",
"value": "/usr/share/tomcat/webapps/sample/SentinelMonitor_QueueContextUpdateReport.txt"
},
{
"name": "formatter",
"value": "json"
},
{
"name": "delimiter",
"value": ";"
},
{
"name": "tagDataSeparator",
"value": "="
},
{
"name": "SendingDelay",
"value": "1000"
}
],
"events": [
{
"name": "QueueContextUpdate"
},
{
"name": "QueueVolumeHigh"
},
{
"name": "MissingQueueData"
}
]
}
],
"producers": [],
"name": "SentinelMonitor"
}
}
The issue is that the initiator of the temporal context that your EPA is using is the QueueContextUpdate event that you are looking to find. Since this event doesn't arrive, the context is not initiated... and the EPA is not active at all...
For testing, I would suggest to change the initiator of the temporal context to At Startup and try to run again.
Later, you will need to decide what is the right definition of this temporal context, and what is the right initiator. Maybe you want to set this temporal context to be of Sliding Time Window type?