github.com/argoproj/argo-events@v1.9.1/docs/eventsources/setup/file.md (about) 1 # File 2 3 File event-source listens to file system events and helps sensor trigger workloads. 4 5 ## Event Structure 6 7 The structure of an event dispatched by the event-source over the eventbus looks like following, 8 9 { 10 "context": { 11 "type": "type_of_event_source", 12 "specversion": "cloud_events_version", 13 "source": "name_of_the_event_source", 14 "id": "unique_event_id", 15 "time": "event_time", 16 "datacontenttype": "type_of_data", 17 "subject": "name_of_the_configuration_within_event_source" 18 }, 19 "data": { 20 "name": "Relative path to the file or directory", 21 "op": "File operation that triggered the event" // Create, Write, Remove, Rename, Chmod 22 } 23 } 24 25 ## Specification 26 27 File event-source specification is available [here](https://github.com/argoproj/argo-events/blob/master/api/event-source.md#fileeventsource). 28 29 ## Setup 30 31 1. Create the event source by running the following command. 32 33 kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/file.yaml 34 35 1. The event source has configuration to listen to file system events for `test-data` directory and file called `x.txt`. 36 37 1. Create the sensor by running the following command. 38 39 kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/file.yaml 40 41 1. Log into the event-source pod by running following command. 42 43 kubectl -n argo-events exec -it <event-source-pod-name> -c file-events -- /bin/bash 44 45 1. Let's create a file called `x.txt` under `test-data` directory in the event-source pod. 46 47 cd test-data 48 cat <<EOF > x.txt 49 hello 50 EOF 51 52 1. Once you create file `x.txt`, the sensor will trigger argo workflow. Run `argo list` to find the workflow. 53 54 1. For real-world use cases, you should use PersistentVolumeClaim. 55 56 ## Troubleshoot 57 58 Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).