Skip to content

Commit 1416104

Browse files
authored
Python sample (#40)
* add python samples * consolidate the components and update doc to reflect the new cli * consolidate the kafka * update readme * wrong typing * change to dapr state binding * add the default dockerfile * Delete sample.dat * Delete sample.dat * Delete .funcignore
1 parent 67bcc1b commit 1416104

File tree

34 files changed

+612
-94
lines changed

34 files changed

+612
-94
lines changed

samples/dotnet-azurefunction/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We'll be running a Darp'd function app locally:
1010
This sample requires you to have the following installed on your machine:
1111
- [Setup Dapr](https://github.com/dapr/samples/tree/master/1.hello-world) : Follow [instructions](https://github.com/dapr/docs/blob/master/getting-started/environment-setup.md#environment-setup) to download and install the Dapr CLI and initialize Dapr.
1212
- [Install Azure Functions Core Tool](https://github.com/Azure/azure-functions-core-tools/blob/master/README.md#windows)
13-
- [Run Kafka Docker Container Locally](https://github.com/dapr/samples/tree/master/5.bindings)
13+
- [Run Kafka Docker Container Locally](https://github.com/dapr/samples/tree/master/5.bindings). The required Kafka files is located in `sample\dapr-kafka` directory.
1414

1515
# Step 1 - Understand the Settings
1616

@@ -52,7 +52,7 @@ spec:
5252
Run function host with Dapr:
5353

5454
```
55-
dapr run --app-id functionapp --app-port 3001 --port 3501 func host start
55+
dapr run --app-id functionapp --app-port 3001 --port 3501 --components-path ..\components\ -- func host start
5656
```
5757

5858
The command should output the dapr logs that look like the following:
@@ -201,7 +201,7 @@ public static void Run(
201201
Then let's see what will happen if we publish a message to topic A using the Dapr cli:
202202

203203
```powershell
204-
dapr publish --topic A --payload 'This is a test'
204+
dapr publish --topic A --data 'This is a test'
205205
```
206206

207207
The Dapr logs should show the following:

samples/dotnet-azurefunction/dotnet-azurefunction.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
<ProjectReference Include="..\..\src\DaprExtension\DaprExtension.csproj" />
1313
</ItemGroup>
1414
<ItemGroup>
15-
<None Update="components\messagebus.yaml">
16-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17-
</None>
18-
<None Update="components\statestore.yaml">
19-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
20-
</None>
2115
<None Update="host.json">
2216
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2317
</None>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = async function (context) {
22
context.log("Node function processed a CreateNewOrder request from the Dapr Runtime.");
3-
context.bindings.order = context.bindings.payload["data"];
3+
context.bindings.order = {"value": context.bindings.payload["data"]};
44
};

samples/javascript-azurefunction/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This sample requires you to have the following installed on your machine:
1111
- [Setup Dapr](https://github.com/dapr/samples/tree/master/1.hello-world) : Follow [instructions](https://github.com/dapr/docs/blob/master/getting-started/environment-setup.md#environment-setup) to download and install the Dapr CLI and initialize Dapr.
1212
- [Install Azure Functions Core Tool](https://github.com/Azure/azure-functions-core-tools/blob/master/README.md#windows)
1313
- [Install .NET Core SDK](https://dotnet.microsoft.com/download)
14-
- [Run Kafka Docker Container Locally](https://github.com/dapr/samples/tree/master/5.bindings)
14+
- [Run Kafka Docker Container Locally](https://github.com/dapr/samples/tree/master/5.bindings). The required Kafka files is located in `sample\dapr-kafka` directory.
1515

1616
# Step 1 - Understand the Settings
1717

@@ -72,7 +72,7 @@ func extensions install -p Dapr.AzureFunctions.Extension -v <version>
7272
Run function host with Dapr:
7373

7474
```
75-
dapr run --app-id functionapp --app-port 3001 --port 3501 -- func host start --no-build
75+
dapr run --app-id functionapp --app-port 3001 --port 3501 --components-path ..\components\ -- func host start --no-build
7676
```
7777

7878
The command should output the dapr logs that look like the following:
@@ -197,7 +197,7 @@ module.exports = async function (context) {
197197
Then let's see what will happen if we publish a message to topic A using the Dapr cli:
198198

199199
```powershell
200-
dapr publish --topic A --payload 'This is a test'
200+
dapr publish --topic A --data 'This is a test'
201201
```
202202

203203
The Dapr logs should show the following:

samples/javascript-azurefunction/components/kafka_bindings.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)