You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bindings/python/http/README.md
+47-9Lines changed: 47 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,27 @@
1
1
# Dapr Bindings (HTTP)
2
2
3
-
In this quickstart, you'll create a microservice to demonstrate Dapr's bindings API to work with external systems as inputs and outputs. The service listens to input binding events from a system CRON and then outputs the contents of local data to a PostreSql output binding.
3
+
In this quickstart, you'll create a microservice to demonstrate Dapr's bindings API to work with external systems as inputs and outputs. The service listens to input binding events from a system CRON and then outputs the contents of local data to a PostgreSQL output binding.
4
4
5
5
Visit [this](https://docs.dapr.io/developing-applications/building-blocks/bindings/) link for more information about Dapr and Bindings.
6
6
7
-
> **Note:** This example leverages only HTTP REST. If you are looking for the example using the Dapr SDK [click here](../sdk).
7
+
> **Note:** This example leverages only HTTP REST. If you are looking for the example using the Dapr SDK [click here](../sdk).
8
8
9
9
This quickstart includes one service:
10
-
11
-
- Python service `batch`
12
10
13
-
### Run and initialize PostgreSQL container
11
+
- Python service `batch-http`
14
12
15
-
1. Open a new terminal, change directories to `../../db`, and run the container with [Docker Compose](https://docs.docker.com/compose/):
1. Open a new terminal, change directories to `../../db`, and run the container with [Docker Compose](https://docs.docker.com/compose/):
16
25
17
26
<!-- STEP
18
27
name: Run and initialize PostgreSQL container
@@ -28,9 +37,11 @@ docker compose up -d
28
37
29
38
<!-- END_STEP -->
30
39
31
-
### Run Python service with Dapr
40
+
---
41
+
42
+
## Run Python service with Dapr
32
43
33
-
2. Open a new terminal window, change directories to `./batch` in the quickstart directory and run:
44
+
2. Open a new terminal window, change directories to `./batch` in the quickstart directory and run:
34
45
35
46
<!-- STEP
36
47
name: Install python dependencies
@@ -44,7 +55,9 @@ cd ..
44
55
45
56
<!-- END_STEP -->
46
57
47
-
3. Run the Python service app with Dapr:
58
+
---
59
+
60
+
3. From the quickstart directory `bindings/python/http`, run the Python service app with Dapr:
48
61
49
62
<!-- STEP
50
63
name: Run batch-http service
@@ -64,3 +77,28 @@ dapr run -f .
64
77
```
65
78
66
79
<!-- END_STEP -->
80
+
81
+
The `-f` flag runs the application using the **Multi-App Run configuration** defined in `dapr.yaml`, automatically starting both the application and its Dapr sidecar.
82
+
83
+
The cron input binding triggers the service every 10 seconds, and the service writes records to PostgreSQL using the output binding.
84
+
85
+
---
86
+
87
+
## Verify Data Persistence
88
+
89
+
4. Open a new terminal window and run the following command to check the rows in the database:
Copy file name to clipboardExpand all lines: bindings/python/sdk/README.md
+47-9Lines changed: 47 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,27 @@
1
1
# Dapr Bindings (Dapr SDK)
2
2
3
-
In this quickstart, you'll create a microservice to demonstrate Dapr's bindings API to work with external systems as inputs and outputs. The service listens to input binding events from a system CRON and then outputs the contents of local data to a PostreSql output binding.
3
+
In this quickstart, you'll create a microservice to demonstrate Dapr's bindings API to work with external systems as inputs and outputs. The service listens to input binding events from a system CRON and then outputs the contents of local data to a PostgreSQL output binding.
4
4
5
5
Visit [this](https://docs.dapr.io/developing-applications/building-blocks/bindings/) link for more information about Dapr and Bindings.
6
6
7
-
> **Note:** This example leverages the Dapr SDK. If you are looking for the example using HTTP REST only [click here](../http).
7
+
> **Note:** This example leverages the Dapr SDK. If you are looking for the example using HTTP REST only [click here](../http).
8
8
9
9
This quickstart includes one service:
10
-
11
-
- Python service `batch`
12
10
13
-
### Run and initialize PostgreSQL container
11
+
- Python service `batch-sdk`
14
12
15
-
1. Open a new terminal, change directories to `../../db`, and run the container with [Docker Compose](https://docs.docker.com/compose/):
1. Open a new terminal, change directories to `../../db`, and run the container with [Docker Compose](https://docs.docker.com/compose/):
16
25
17
26
<!-- STEP
18
27
name: Run and initialize PostgreSQL container
@@ -28,9 +37,11 @@ docker compose up -d
28
37
29
38
<!-- END_STEP -->
30
39
31
-
### Run Python service with Dapr
40
+
---
41
+
42
+
## Run Python service with Dapr
32
43
33
-
2. Open a new terminal window, change directories to `./batch` in the quickstart directory and run:
44
+
2. Open a new terminal window, change directories to `./batch` in the quickstart directory and run:
34
45
35
46
<!-- STEP
36
47
name: Install python dependencies
@@ -44,7 +55,9 @@ cd ..
44
55
45
56
<!-- END_STEP -->
46
57
47
-
3. Run the Python service app with Dapr:
58
+
---
59
+
60
+
3. From the quickstart directory `bindings/python/sdk`, run the Python service app with Dapr:
48
61
49
62
<!-- STEP
50
63
name: Run batch-sdk service
@@ -64,3 +77,28 @@ dapr run -f .
64
77
```
65
78
66
79
<!-- END_STEP -->
80
+
81
+
The `-f` flag runs the application using the **Multi-App Run configuration** defined in `dapr.yaml`, automatically starting both the application and its Dapr sidecar.
82
+
83
+
The cron input binding triggers the service every 10 seconds, and the service writes records to PostgreSQL using the output binding.
84
+
85
+
---
86
+
87
+
## Verify Data Persistence
88
+
89
+
4. Open a new terminal window and run the following command to check the rows in the database:
0 commit comments