File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -198,16 +198,32 @@ source_config = dict(kind='file-watch-source',
198198 events='DELETE,CREATE')
199199```
200200
201- The event format for this source is:
201+ The returned result is a JSON message with the following structure:
202+
202203```
203- <event_type>:file=<filename>
204+ {"filename": <filename_value>, "event_type": <event_type>}
204205```
206+ where event_type is one of ` DELETE ` , ` CREATE ` or ` MODIFY `
205207
206208For example, when the file ` test.txt ` is deleted from the watched folder the event returned is:
207209```
208- DELETE:file=/absolute/path/to/test.txt
210+ {
211+ "filename": "/absolute/path/to/test.txt",
212+ "event_type": "DELETE"
213+ }
209214```
210215
216+ Convert the event to JSON when handling the event:
217+
218+ ```
219+ import json
220+ json_event = json.loads(event)
221+ ```
222+ and then access its field like so:
223+ ```
224+ json_event['filename']
225+ json_event['event_type']
226+ ```
211227
212228## Sinks
213229
You can’t perform that action at this time.
0 commit comments