This documentation and the Cisco Observability Platform functionalities it describes are subject to change. Data saved on the platform may disappear and APIs may change without notice.
Define Codex Workflows in Your Solution Manifest
To define Codex workflows in your solution:
Log in to
fsoc
with your developer credentials, which should already be in~/.fsoc
:fsoc login
In
<your-solution-directory>/manifest.json
, add Codex to the dependencies array and add the location of allcodex:workflow
to the objects array. For example, the followingmanifest.json
file of the solution Space Fleet includes the dependency as the Codex platform and its object files:{ "manifestVersion": "1.0.0", "name": "spacefleet", "solutionVersion": "0.0.134", "dependencies": ["codex"], "description": "Space Fleet reference solution", "contact": "support@appd.com", "gitRepoUrl": "<Your solution's git repository URL>", "readme": "readme.md", "types": [], "objects": [ { "type": "codex:workflow", "objectsFile": "objects/codex/workflow-1.json" }, { "type": "codex:workflow", "objectsFile": "objects/codex/workflow-2.json" } ] }
Create a file named
<your-solution-directory>/objects/codex/<workflow-name>.json
and declare yourcodex:workflow
object using the Serverless workflow schema. For example, the following workflow is created to take the news feed event from Space Fleet and compute a count metric for calculating the number of events received for a certain period.{ "id": "SpaceFleetNewsfeedCountMetricGenerator", "version": "1.0", "specVersion": "0.8", "name": "SpaceFleetNewsfeedCountMetricGenerator", "expressionLang": "Jsonata", "description": "Generate newsfeed_count metric from the newsfeed event", "metadata": { "solution": "spacefleet" }, "start": "EventReceived", "functions": [ { "name": "CreateMeasurementFunction", "type": "expression", "operation": "{\"entity\":entities[0],\"type\":\"spacefleet:newsfeed_count\",\"attributes\":attributes,\"measurements\":[{\"timestamp\":timestamp,\"intValue\":1}]}" } ], "events": [ { "name": "EventEnriched", "type": "contracts:cloudevent/platform:event.enriched.v1", "source": "platform", "kind": "consumed" }, { "name": "RawMeasurementCreated", "type": "contracts:cloudevent/platform:measurement.received.v1", "source": "platform", "kind": "produced" } ], "states": [ { "name": "EventReceived", "type": "event", "onEvents": [ { "eventRefs": [ "EventEnriched" ], "eventDataFilter": { "data": "${ data }" } } ], "transition": "EventFilter" }, { "name": "EventFilter", "type": "switch", "dataConditions": [ { "condition": "type = \"spacefleet:newsfeed\"", "transition": "GenerateMeasurement" } ], "defaultCondition": { "end": true } }, { "name": "GenerateMeasurement", "type": "operation", "actions": [ { "functionRef": { "refName": "CreateMeasurementFunction" }, "actionDataFilter": { "toStateData": "${ measurement }" } } ], "end": { "terminate": true, "produceEvents": [ { "eventRef": "RawMeasurementCreated", "data": "${ measurement }" } ] } } ] }
Each time you modify your solution:
Increment solutionVersion in
manifest.json
.Check your solution with the fsoc solution check command.
Run the fsoc solution validate command to catch errors that would cause
fsoc solution push
to fail.Republish your solution with the fsoc solution push command.