mirror of https://github.com/dapr/docs.git
Merge branch 'v1.11' into crypto-js
This commit is contained in:
commit
fef19e8d62
|
@ -30,10 +30,12 @@ The Dapr sidecar doesn’t load any workflow definitions. Rather, the sidecar si
|
||||||
|
|
||||||
[Workflow activities]({{< ref "workflow-features-concepts.md#workflow-activites" >}}) are the basic unit of work in a workflow and are the tasks that get orchestrated in the business process.
|
[Workflow activities]({{< ref "workflow-features-concepts.md#workflow-activites" >}}) are the basic unit of work in a workflow and are the tasks that get orchestrated in the business process.
|
||||||
|
|
||||||
{{< tabs ".NET" >}}
|
{{< tabs ".NET" Python >}}
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
|
<!--csharp-->
|
||||||
|
|
||||||
Define the workflow activities you'd like your workflow to perform. Activities are a class definition and can take inputs and outputs. Activities also participate in dependency injection, like binding to a Dapr client.
|
Define the workflow activities you'd like your workflow to perform. Activities are a class definition and can take inputs and outputs. Activities also participate in dependency injection, like binding to a Dapr client.
|
||||||
|
|
||||||
The activities called in the example below are:
|
The activities called in the example below are:
|
||||||
|
@ -96,6 +98,24 @@ public class ProcessPaymentActivity : WorkflowActivity<PaymentRequest, object>
|
||||||
|
|
||||||
[See the full `ProcessPaymentActivity.cs` workflow activity example.](https://github.com/dapr/dotnet-sdk/blob/master/examples/Workflow/WorkflowConsoleApp/Activities/ProcessPaymentActivity.cs)
|
[See the full `ProcessPaymentActivity.cs` workflow activity example.](https://github.com/dapr/dotnet-sdk/blob/master/examples/Workflow/WorkflowConsoleApp/Activities/ProcessPaymentActivity.cs)
|
||||||
|
|
||||||
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
{{% codetab %}}
|
||||||
|
|
||||||
|
<!--python-->
|
||||||
|
|
||||||
|
Define the workflow activities you'd like your workflow to perform. Activities are a function definition and can take inputs and outputs. The following example creates a counter (activity) called `hello_act` that notifies users of the current counter value. `hello_act` is a function derived from a class called `WorkflowActivityContext`.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def hello_act(ctx: WorkflowActivityContext, input):
|
||||||
|
global counter
|
||||||
|
counter += input
|
||||||
|
print(f'New counter value is: {counter}!', flush=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
[See the `hello_act` workflow activity in context.](https://github.com/dapr/python-sdk/blob/master/examples/demo_workflow/app.py#LL40C1-L43C59)
|
||||||
|
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
@ -104,10 +124,12 @@ public class ProcessPaymentActivity : WorkflowActivity<PaymentRequest, object>
|
||||||
|
|
||||||
Next, register and call the activites in a workflow.
|
Next, register and call the activites in a workflow.
|
||||||
|
|
||||||
{{< tabs ".NET" >}}
|
{{< tabs ".NET" Python >}}
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
|
<!--csharp-->
|
||||||
|
|
||||||
The `OrderProcessingWorkflow` class is derived from a base class called `Workflow` with input and output parameter types. It also includes a `RunAsync` method that does the heavy lifting of the workflow and calls the workflow activities.
|
The `OrderProcessingWorkflow` class is derived from a base class called `Workflow` with input and output parameter types. It also includes a `RunAsync` method that does the heavy lifting of the workflow and calls the workflow activities.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
|
@ -144,6 +166,28 @@ The `OrderProcessingWorkflow` class is derived from a base class called `Workflo
|
||||||
|
|
||||||
[See the full workflow example in `OrderProcessingWorkflow.cs`.](https://github.com/dapr/dotnet-sdk/blob/master/examples/Workflow/WorkflowConsoleApp/Workflows/OrderProcessingWorkflow.cs)
|
[See the full workflow example in `OrderProcessingWorkflow.cs`.](https://github.com/dapr/dotnet-sdk/blob/master/examples/Workflow/WorkflowConsoleApp/Workflows/OrderProcessingWorkflow.cs)
|
||||||
|
|
||||||
|
|
||||||
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
{{% codetab %}}
|
||||||
|
|
||||||
|
<!--python-->
|
||||||
|
|
||||||
|
The `hello_world_wf` function is derived from a class called `DaprWorkflowContext` with input and output parameter types. It also includes a `yield` statement that does the heavy lifting of the workflow and calls the workflow activities.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def hello_world_wf(ctx: DaprWorkflowContext, input):
|
||||||
|
print(f'{input}')
|
||||||
|
yield ctx.call_activity(hello_act, input=1)
|
||||||
|
yield ctx.call_activity(hello_act, input=10)
|
||||||
|
yield ctx.wait_for_external_event("event1")
|
||||||
|
yield ctx.call_activity(hello_act, input=100)
|
||||||
|
yield ctx.call_activity(hello_act, input=1000)
|
||||||
|
```
|
||||||
|
|
||||||
|
[See the `hello_world_wf` workflow in context.](https://github.com/dapr/python-sdk/blob/master/examples/demo_workflow/app.py#LL32C1-L38C51)
|
||||||
|
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
@ -152,10 +196,12 @@ The `OrderProcessingWorkflow` class is derived from a base class called `Workflo
|
||||||
|
|
||||||
Finally, compose the application using the workflow.
|
Finally, compose the application using the workflow.
|
||||||
|
|
||||||
{{< tabs ".NET" >}}
|
{{< tabs ".NET" Python >}}
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
|
<!--csharp-->
|
||||||
|
|
||||||
[In the following `Program.cs` example](https://github.com/dapr/dotnet-sdk/blob/master/examples/Workflow/WorkflowConsoleApp/Program.cs), for a basic ASP.NET order processing application using the .NET SDK, your project code would include:
|
[In the following `Program.cs` example](https://github.com/dapr/dotnet-sdk/blob/master/examples/Workflow/WorkflowConsoleApp/Program.cs), for a basic ASP.NET order processing application using the .NET SDK, your project code would include:
|
||||||
|
|
||||||
- A NuGet package called `Dapr.Workflow` to receive the .NET SDK capabilities
|
- A NuGet package called `Dapr.Workflow` to receive the .NET SDK capabilities
|
||||||
|
@ -223,8 +269,97 @@ app.Run();
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{% codetab %}}
|
||||||
|
|
||||||
|
<!--python-->
|
||||||
|
|
||||||
|
[In the following example](https://github.com/dapr/python-sdk/blob/master/examples/demo_workflow/app.py), for a basic Python hello world application using the Python SDK, your project code would include:
|
||||||
|
|
||||||
|
- A Python package called `DaprClient` to receive the Python SDK capabilities.
|
||||||
|
- A builder with extensions called:
|
||||||
|
- `WorkflowRuntime`: Allows you to register workflows and workflow activities
|
||||||
|
- `DaprWorkflowContext`: Allows you to [create workflows]({{< ref "#write-the-workflow" >}})
|
||||||
|
- `WorkflowActivityContext`: Allows you to [create workflow activities]({{< ref "#write-the-workflow-activities" >}})
|
||||||
|
- API calls. In the example below, these calls start, pause, resume, purge, and terminate the workflow.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from dapr.ext.workflow import WorkflowRuntime, DaprWorkflowContext, WorkflowActivityContext
|
||||||
|
from dapr.clients import DaprClient
|
||||||
|
|
||||||
|
# ...
|
||||||
|
|
||||||
|
def main():
|
||||||
|
with DaprClient() as d:
|
||||||
|
host = settings.DAPR_RUNTIME_HOST
|
||||||
|
port = settings.DAPR_GRPC_PORT
|
||||||
|
workflowRuntime = WorkflowRuntime(host, port)
|
||||||
|
workflowRuntime = WorkflowRuntime()
|
||||||
|
workflowRuntime.register_workflow(hello_world_wf)
|
||||||
|
workflowRuntime.register_activity(hello_act)
|
||||||
|
workflowRuntime.start()
|
||||||
|
|
||||||
|
# Start workflow
|
||||||
|
print("==========Start Counter Increase as per Input:==========")
|
||||||
|
start_resp = d.start_workflow(instance_id=instanceId, workflow_component=workflowComponent,
|
||||||
|
workflow_name=workflowName, input=inputData, workflow_options=workflowOptions)
|
||||||
|
print(f"start_resp {start_resp.instance_id}")
|
||||||
|
|
||||||
|
# ...
|
||||||
|
|
||||||
|
# Pause workflow
|
||||||
|
d.pause_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
getResponse = d.get_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
print(f"Get response from {workflowName} after pause call: {getResponse.runtime_status}")
|
||||||
|
|
||||||
|
# Resume workflow
|
||||||
|
d.resume_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
getResponse = d.get_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
print(f"Get response from {workflowName} after resume call: {getResponse.runtime_status}")
|
||||||
|
|
||||||
|
sleep(1)
|
||||||
|
# Raise workflow
|
||||||
|
d.raise_workflow_event(instance_id=instanceId, workflow_component=workflowComponent,
|
||||||
|
event_name=eventName, event_data=eventData)
|
||||||
|
|
||||||
|
sleep(5)
|
||||||
|
# Purge workflow
|
||||||
|
d.purge_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
try:
|
||||||
|
getResponse = d.get_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
except DaprInternalError as err:
|
||||||
|
if nonExistentIDError in err._message:
|
||||||
|
print("Instance Successfully Purged")
|
||||||
|
|
||||||
|
# Kick off another workflow for termination purposes
|
||||||
|
start_resp = d.start_workflow(instance_id=instanceId, workflow_component=workflowComponent,
|
||||||
|
workflow_name=workflowName, input=inputData, workflow_options=workflowOptions)
|
||||||
|
print(f"start_resp {start_resp.instance_id}")
|
||||||
|
|
||||||
|
# Terminate workflow
|
||||||
|
d.terminate_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
sleep(1)
|
||||||
|
getResponse = d.get_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
print(f"Get response from {workflowName} after terminate call: {getResponse.runtime_status}")
|
||||||
|
|
||||||
|
# Purge workflow
|
||||||
|
d.purge_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
try:
|
||||||
|
getResponse = d.get_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
except DaprInternalError as err:
|
||||||
|
if nonExistentIDError in err._message:
|
||||||
|
print("Instance Successfully Purged")
|
||||||
|
|
||||||
|
workflowRuntime.shutdown()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
|
||||||
{{% alert title="Important" color="warning" %}}
|
{{% alert title="Important" color="warning" %}}
|
||||||
|
@ -241,4 +376,6 @@ Now that you've authored a workflow, learn how to manage it.
|
||||||
## Related links
|
## Related links
|
||||||
- [Workflow overview]({{< ref workflow-overview.md >}})
|
- [Workflow overview]({{< ref workflow-overview.md >}})
|
||||||
- [Workflow API reference]({{< ref workflow_api.md >}})
|
- [Workflow API reference]({{< ref workflow_api.md >}})
|
||||||
- [Try out the .NET example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
- Try out the full SDK examples:
|
||||||
|
- [.NET example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
||||||
|
- [Python example](https://github.com/dapr/python-sdk/tree/master/examples/demo_workflow)
|
||||||
|
|
|
@ -8,12 +8,12 @@ description: Manage and run workflows
|
||||||
|
|
||||||
Now that you've [authored the workflow and its activities in your application]({{< ref howto-author-workflow.md >}}), you can start, terminate, and get information about the workflow using HTTP API calls. For more information, read the [workflow API reference]({{< ref workflow_api.md >}}).
|
Now that you've [authored the workflow and its activities in your application]({{< ref howto-author-workflow.md >}}), you can start, terminate, and get information about the workflow using HTTP API calls. For more information, read the [workflow API reference]({{< ref workflow_api.md >}}).
|
||||||
|
|
||||||
{{< tabs ".NET SDK" HTTP >}}
|
{{< tabs ".NET" Python HTTP >}}
|
||||||
|
|
||||||
<!--NET-->
|
<!--NET-->
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
Manage your workflow within your code. In the `OrderProcessingWorkflow` example from the [Author a workflow]({{< ref "howto-author-workflow.md#write-the-workflow" >}}) guide, the workflow is registered in the code. You can now start, terminate, and get information about a running workflow:
|
Manage your workflow within your code. In the `OrderProcessingWorkflow` example from the [Author a workflow]({{< ref "howto-author-workflow.md#write-the-application" >}}) guide, the workflow is registered in the code. You can now start, terminate, and get information about a running workflow:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
string orderId = "exampleOrderId";
|
string orderId = "exampleOrderId";
|
||||||
|
@ -46,6 +46,56 @@ await daprClient.PurgeWorkflowAsync(orderId, workflowComponent);
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
<!--Python-->
|
||||||
|
{{% codetab %}}
|
||||||
|
|
||||||
|
Manage your workflow within your code. In the workflow example from the [Author a workflow]({{< ref "howto-author-workflow.md#write-the-application" >}}) guide, the workflow is registered in the code using the following APIs:
|
||||||
|
- **start_workflow**: Start an instance of a workflow
|
||||||
|
- **get_workflow**: Get information on the status of the workflow
|
||||||
|
- **pause_workflow**: Pauses or suspends a workflow instance that can later be resumed
|
||||||
|
- **resume_workflow**: Resumes a paused workflow instance
|
||||||
|
- **raise_workflow_event**: Raise an event on a workflow
|
||||||
|
- **purge_workflow**: Removes all metadata related to a specific workflow instance
|
||||||
|
- **terminate_workflow**: Terminate or stop a particular instance of a workflow
|
||||||
|
|
||||||
|
```python
|
||||||
|
from dapr.ext.workflow import WorkflowRuntime, DaprWorkflowContext, WorkflowActivityContext
|
||||||
|
from dapr.clients import DaprClient
|
||||||
|
|
||||||
|
# Sane parameters
|
||||||
|
instanceId = "exampleInstanceID"
|
||||||
|
workflowComponent = "dapr"
|
||||||
|
workflowName = "hello_world_wf"
|
||||||
|
eventName = "event1"
|
||||||
|
eventData = "eventData"
|
||||||
|
|
||||||
|
# Start the workflow
|
||||||
|
start_resp = d.start_workflow(instance_id=instanceId, workflow_component=workflowComponent,
|
||||||
|
workflow_name=workflowName, input=inputData, workflow_options=workflowOptions)
|
||||||
|
|
||||||
|
# Get info on the workflow
|
||||||
|
getResponse = d.get_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
|
||||||
|
# Pause the workflow
|
||||||
|
d.pause_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
|
||||||
|
# Resume the workflow
|
||||||
|
d.resume_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
|
||||||
|
# Raise an event on the workflow.
|
||||||
|
d.raise_workflow_event(instance_id=instanceId, workflow_component=workflowComponent,
|
||||||
|
event_name=eventName, event_data=eventData)
|
||||||
|
|
||||||
|
# Purge the workflow
|
||||||
|
d.purge_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
|
||||||
|
# Terminate the workflow
|
||||||
|
d.terminate_workflow(instance_id=instanceId, workflow_component=workflowComponent)
|
||||||
|
```
|
||||||
|
|
||||||
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
<!--HTTP-->
|
<!--HTTP-->
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
|
@ -121,5 +171,7 @@ Learn more about these HTTP calls in the [workflow API reference guide]({{< ref
|
||||||
|
|
||||||
## Next steps
|
## Next steps
|
||||||
- [Try out the Workflow quickstart]({{< ref workflow-quickstart.md >}})
|
- [Try out the Workflow quickstart]({{< ref workflow-quickstart.md >}})
|
||||||
- [Try out the .NET example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
- Try out the full SDK examples:
|
||||||
|
- [.NET example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
||||||
|
- [Python example](https://github.com/dapr/python-sdk/blob/master/examples/demo_workflow/app.py)
|
||||||
- [Workflow API reference]({{< ref workflow_api.md >}})
|
- [Workflow API reference]({{< ref workflow_api.md >}})
|
||||||
|
|
|
@ -81,6 +81,8 @@ You can use the following SDKs to author a workflow.
|
||||||
| Language stack | Package |
|
| Language stack | Package |
|
||||||
| - | - |
|
| - | - |
|
||||||
| .NET | [Dapr.Workflow](https://www.nuget.org/profiles/dapr.io) |
|
| .NET | [Dapr.Workflow](https://www.nuget.org/profiles/dapr.io) |
|
||||||
|
| Python | [dapr-ext-workflow](https://github.com/dapr/python-sdk/tree/master/ext/dapr-ext-workflow) |
|
||||||
|
|
||||||
|
|
||||||
## Try out workflows
|
## Try out workflows
|
||||||
|
|
||||||
|
@ -92,6 +94,8 @@ Want to put workflows to the test? Walk through the following quickstart and tut
|
||||||
| ------------------- | ----------- |
|
| ------------------- | ----------- |
|
||||||
| [Workflow quickstart]({{< ref workflow-quickstart.md >}}) | Run a .NET workflow application with four workflow activities to see Dapr Workflow in action |
|
| [Workflow quickstart]({{< ref workflow-quickstart.md >}}) | Run a .NET workflow application with four workflow activities to see Dapr Workflow in action |
|
||||||
| [Workflow .NET SDK example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow) | Learn how to create a Dapr Workflow and invoke it using ASP.NET Core web APIs. |
|
| [Workflow .NET SDK example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow) | Learn how to create a Dapr Workflow and invoke it using ASP.NET Core web APIs. |
|
||||||
|
| [Workflow Python SDK example](https://github.com/dapr/python-sdk/tree/master/examples/demo_workflow) | Learn how to create a Dapr Workflow and invoke it using the Python `DaprClient` package. |
|
||||||
|
|
||||||
|
|
||||||
### Start using workflows directly in your app
|
### Start using workflows directly in your app
|
||||||
|
|
||||||
|
@ -110,4 +114,6 @@ Watch [this video for an overview on Dapr Workflow](https://youtu.be/s1p9MNl4VGo
|
||||||
## Related links
|
## Related links
|
||||||
|
|
||||||
- [Workflow API reference]({{< ref workflow_api.md >}})
|
- [Workflow API reference]({{< ref workflow_api.md >}})
|
||||||
- [Try out the .NET example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
- Try out the full SDK examples:
|
||||||
|
- [.NET example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
|
||||||
|
- [Python example](https://github.com/dapr/python-sdk/tree/master/examples/demo_workflow)
|
||||||
|
|
|
@ -67,6 +67,10 @@ spec:
|
||||||
| oidcClientID | N | Input/Output | The OAuth2 client ID that has been provisioned in the identity provider. Required when `authType` is set to `oidc` | `dapr-kafka` |
|
| oidcClientID | N | Input/Output | The OAuth2 client ID that has been provisioned in the identity provider. Required when `authType` is set to `oidc` | `dapr-kafka` |
|
||||||
| oidcClientSecret | N | Input/Output | The OAuth2 client secret that has been provisioned in the identity provider: Required when `authType` is set to `oidc` | `"KeFg23!"` |
|
| oidcClientSecret | N | Input/Output | The OAuth2 client secret that has been provisioned in the identity provider: Required when `authType` is set to `oidc` | `"KeFg23!"` |
|
||||||
| oidcScopes | N | Input/Output | Comma-delimited list of OAuth2/OIDC scopes to request with the access token. Recommended when `authType` is set to `oidc`. Defaults to `"openid"` | `"openid,kafka-prod"` |
|
| oidcScopes | N | Input/Output | Comma-delimited list of OAuth2/OIDC scopes to request with the access token. Recommended when `authType` is set to `oidc`. Defaults to `"openid"` | `"openid,kafka-prod"` |
|
||||||
|
| version | N | Input/Output | Kafka cluster version. Defaults to 2.0.0. Please note that this needs to be mandatorily set to `1.0.0` for EventHubs with Kafka. | `1.0.0` |
|
||||||
|
|
||||||
|
#### Note
|
||||||
|
The metadata `version` must be set to `1.0.0` when using Azure EventHubs with Kafka.
|
||||||
|
|
||||||
## Binding support
|
## Binding support
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ spec:
|
||||||
| maxMessageBytes | N | The maximum size in bytes allowed for a single Kafka message. Defaults to 1024. | `2048`
|
| maxMessageBytes | N | The maximum size in bytes allowed for a single Kafka message. Defaults to 1024. | `2048`
|
||||||
| consumeRetryInterval | N | The interval between retries when attempting to consume topics. Treats numbers without suffix as milliseconds. Defaults to 100ms. | `200ms` |
|
| consumeRetryInterval | N | The interval between retries when attempting to consume topics. Treats numbers without suffix as milliseconds. Defaults to 100ms. | `200ms` |
|
||||||
| consumeRetryEnabled | N | Disable consume retry by setting `"false"` | `"true"`, `"false"` |
|
| consumeRetryEnabled | N | Disable consume retry by setting `"false"` | `"true"`, `"false"` |
|
||||||
| version | N | Kafka cluster version. Defaults to 2.0.0.0 | `0.10.2.0` |
|
| version | N | Kafka cluster version. Defaults to 2.0.0. Note that this must be set to `1.0.0` if you are using Azure EventHubs with Kafka. | `0.10.2.0` |
|
||||||
| caCert | N | Certificate authority certificate, required for using TLS. Can be `secretKeyRef` to use a secret reference | `"-----BEGIN CERTIFICATE-----\n<base64-encoded DER>\n-----END CERTIFICATE-----"`
|
| caCert | N | Certificate authority certificate, required for using TLS. Can be `secretKeyRef` to use a secret reference | `"-----BEGIN CERTIFICATE-----\n<base64-encoded DER>\n-----END CERTIFICATE-----"`
|
||||||
| clientCert | N | Client certificate, required for `authType` `mtls`. Can be `secretKeyRef` to use a secret reference | `"-----BEGIN CERTIFICATE-----\n<base64-encoded DER>\n-----END CERTIFICATE-----"`
|
| clientCert | N | Client certificate, required for `authType` `mtls`. Can be `secretKeyRef` to use a secret reference | `"-----BEGIN CERTIFICATE-----\n<base64-encoded DER>\n-----END CERTIFICATE-----"`
|
||||||
| clientKey | N | Client key, required for `authType` `mtls` Can be `secretKeyRef` to use a secret reference | `"-----BEGIN RSA PRIVATE KEY-----\n<base64-encoded PKCS8>\n-----END RSA PRIVATE KEY-----"`
|
| clientKey | N | Client key, required for `authType` `mtls` Can be `secretKeyRef` to use a secret reference | `"-----BEGIN RSA PRIVATE KEY-----\n<base64-encoded PKCS8>\n-----END RSA PRIVATE KEY-----"`
|
||||||
|
@ -78,6 +78,9 @@ spec:
|
||||||
|
|
||||||
The `secretKeyRef` above is referencing a [kubernetes secrets store]({{< ref kubernetes-secret-store.md >}}) to access the tls information. Visit [here]({{< ref setup-secret-store.md >}}) to learn more about how to configure a secret store component.
|
The `secretKeyRef` above is referencing a [kubernetes secrets store]({{< ref kubernetes-secret-store.md >}}) to access the tls information. Visit [here]({{< ref setup-secret-store.md >}}) to learn more about how to configure a secret store component.
|
||||||
|
|
||||||
|
#### Note
|
||||||
|
The metadata `version` must be set to `1.0.0` when using Azure EventHubs with Kafka.
|
||||||
|
|
||||||
### Authentication
|
### Authentication
|
||||||
|
|
||||||
Kafka supports a variety of authentication schemes and Dapr supports several: SASL password, mTLS, OIDC/OAuth2. With the added authentication methods, the `authRequired` field has
|
Kafka supports a variety of authentication schemes and Dapr supports several: SASL password, mTLS, OIDC/OAuth2. With the added authentication methods, the `authRequired` field has
|
||||||
|
|
|
@ -77,6 +77,9 @@ spec:
|
||||||
| batchingMaxSize | N | batchingMaxSize sets the maximum number of bytes permitted in a batch. If set to a value greater than 1, messages will be queued until this threshold is reached or batchingMaxMessages (see above) has been reached or the batch interval has elapsed. Default: `"128KB"` | `"131072"`|
|
| batchingMaxSize | N | batchingMaxSize sets the maximum number of bytes permitted in a batch. If set to a value greater than 1, messages will be queued until this threshold is reached or batchingMaxMessages (see above) has been reached or the batch interval has elapsed. Default: `"128KB"` | `"131072"`|
|
||||||
| <topic-name>.jsonschema | N | Enforces JSON schema validation for the configured topic. |
|
| <topic-name>.jsonschema | N | Enforces JSON schema validation for the configured topic. |
|
||||||
| <topic-name>.avroschema | N | Enforces Avro schema validation for the configured topic. |
|
| <topic-name>.avroschema | N | Enforces Avro schema validation for the configured topic. |
|
||||||
|
| publicKey | N | A public key to be used for publisher and consumer encryption. Value can be one of two options: file path for a local PEM cert, or the cert data string value |
|
||||||
|
| privateKey | N | A private key to be used for consumer encryption. Value can be one of two options: file path for a local PEM cert, or the cert data string value |
|
||||||
|
| keys | N | A comma delimited string containing names of [Pulsar session keys](https://pulsar.apache.org/docs/3.0.x/security-encryption/#how-it-works-in-pulsar). Used in conjunction with `publicKey` for publisher encryption |
|
||||||
|
|
||||||
### Enabling message delivery retries
|
### Enabling message delivery retries
|
||||||
|
|
||||||
|
@ -115,6 +118,90 @@ curl -X POST http://localhost:3500/v1.0/publish/myPulsar/myTopic?metadata.delive
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### E2E Encryption
|
||||||
|
|
||||||
|
Dapr supports setting public and private key pairs to enable Pulsar's [end-to-end encryption feature](https://pulsar.apache.org/docs/3.0.x/security-encryption/).
|
||||||
|
|
||||||
|
#### Enabling publisher encryption from file certs
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
kind: Component
|
||||||
|
metadata:
|
||||||
|
name: messagebus
|
||||||
|
spec:
|
||||||
|
type: pubsub.pulsar
|
||||||
|
version: v1
|
||||||
|
metadata:
|
||||||
|
- name: host
|
||||||
|
value: "localhost:6650"
|
||||||
|
- name: publicKey
|
||||||
|
value: ./public.key
|
||||||
|
- name: keys
|
||||||
|
value: myapp.key
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Enabling consumer encryption from file certs
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
kind: Component
|
||||||
|
metadata:
|
||||||
|
name: messagebus
|
||||||
|
spec:
|
||||||
|
type: pubsub.pulsar
|
||||||
|
version: v1
|
||||||
|
metadata:
|
||||||
|
- name: host
|
||||||
|
value: "localhost:6650"
|
||||||
|
- name: publicKey
|
||||||
|
value: ./public.key
|
||||||
|
- name: privateKey
|
||||||
|
value: ./private.key
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Enabling publisher encryption from value
|
||||||
|
|
||||||
|
> Note: It is recommended to [reference the public key from a secret]({{< ref component-secrets.md >}}).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
kind: Component
|
||||||
|
metadata:
|
||||||
|
name: messagebus
|
||||||
|
spec:
|
||||||
|
type: pubsub.pulsar
|
||||||
|
version: v1
|
||||||
|
metadata:
|
||||||
|
- name: host
|
||||||
|
value: "localhost:6650"
|
||||||
|
- name: publicKey
|
||||||
|
value: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1KDAM4L8RtJ+nLaXBrBh\nzVpvTemsKVZoAct8A+ShepOHT9lgHOCGLFGWNla6K6j+b3AV/P/fAAhwj82vwTDd\nruXSflvSdmYeFAw3Ypphc1A5oM53wSRWhg63potBNWqdDzj8ApYgqjpmjYSQdL5/\na3golb36GYFrY0MLFTv7wZ87pmMIPsOgGIcPbCHker2fRZ34WXYLb1hkeUpwx4eK\njpwcg35gccvR6o/UhbKAuc60V1J9Wof2sNgtlRaQej45wnpjWYzZrIyk5qUbn0Qi\nCdpIrXvYtANq0Id6gP8zJvUEdPIgNuYxEmVCl9jI+8eGI6peD0qIt8U80hf9axhJ\n3QIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||||
|
- name: keys
|
||||||
|
value: myapp.key
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Enabling consumer encryption from value
|
||||||
|
|
||||||
|
> Note: It is recommended to [reference the public and private keys from a secret]({{< ref component-secrets.md >}}).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: dapr.io/v1alpha1
|
||||||
|
kind: Component
|
||||||
|
metadata:
|
||||||
|
name: messagebus
|
||||||
|
spec:
|
||||||
|
type: pubsub.pulsar
|
||||||
|
version: v1
|
||||||
|
metadata:
|
||||||
|
- name: host
|
||||||
|
value: "localhost:6650"
|
||||||
|
- name: publicKey
|
||||||
|
value: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1KDAM4L8RtJ+nLaXBrBh\nzVpvTemsKVZoAct8A+ShepOHT9lgHOCGLFGWNla6K6j+b3AV/P/fAAhwj82vwTDd\nruXSflvSdmYeFAw3Ypphc1A5oM53wSRWhg63potBNWqdDzj8ApYgqjpmjYSQdL5/\na3golb36GYFrY0MLFTv7wZ87pmMIPsOgGIcPbCHker2fRZ34WXYLb1hkeUpwx4eK\njpwcg35gccvR6o/UhbKAuc60V1J9Wof2sNgtlRaQej45wnpjWYzZrIyk5qUbn0Qi\nCdpIrXvYtANq0Id6gP8zJvUEdPIgNuYxEmVCl9jI+8eGI6peD0qIt8U80hf9axhJ\n3QIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||||
|
- name: privateKey
|
||||||
|
value: "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA1KDAM4L8RtJ+nLaXBrBhzVpvTemsKVZoAct8A+ShepOHT9lg\nHOCGLFGWNla6K6j+b3AV/P/fAAhwj82vwTDdruXSflvSdmYeFAw3Ypphc1A5oM53\nwSRWhg63potBNWqdDzj8ApYgqjpmjYSQdL5/a3golb36GYFrY0MLFTv7wZ87pmMI\nPsOgGIcPbCHker2fRZ34WXYLb1hkeUpwx4eKjpwcg35gccvR6o/UhbKAuc60V1J9\nWof2sNgtlRaQej45wnpjWYzZrIyk5qUbn0QiCdpIrXvYtANq0Id6gP8zJvUEdPIg\nNuYxEmVCl9jI+8eGI6peD0qIt8U80hf9axhJ3QIDAQABAoIBAQCKuHnM4ac/eXM7\nQPDVX1vfgyHc3hgBPCtNCHnXfGFRvFBqavKGxIElBvGOcBS0CWQ+Rg1Ca5kMx3TQ\njSweSYhH5A7pe3Sa5FK5V6MGxJvRhMSkQi/lJZUBjzaIBJA9jln7pXzdHx8ekE16\nBMPONr6g2dr4nuI9o67xKrtfViwRDGaG6eh7jIMlEqMMc6WqyhvI67rlVDSTHFKX\njlMcozJ3IT8BtTzKg2Tpy7ReVuJEpehum8yn1ZVdAnotBDJxI07DC1cbOP4M2fHM\ngfgPYWmchauZuTeTFu4hrlY5jg0/WLs6by8r/81+vX3QTNvejX9UdTHMSIfQdX82\nAfkCKUVhAoGBAOvGv+YXeTlPRcYC642x5iOyLQm+BiSX4jKtnyJiTU2s/qvvKkIu\nxAOk3OtniT9NaUAHEZE9tI71dDN6IgTLQlAcPCzkVh6Sc5eG0MObqOO7WOMCWBkI\nlaAKKBbd6cGDJkwGCJKnx0pxC9f8R4dw3fmXWgWAr8ENiekMuvjSfjZ5AoGBAObd\ns2L5uiUPTtpyh8WZ7rEvrun3djBhzi+d7rgxEGdditeiLQGKyZbDPMSMBuus/5wH\nwfi0xUq50RtYDbzQQdC3T/C20oHmZbjWK5mDaLRVzWS89YG/NT2Q8eZLBstKqxkx\ngoT77zoUDfRy+CWs1xvXzgxagD5Yg8/OrCuXOqWFAoGAPIw3r6ELknoXEvihASxU\nS4pwInZYIYGXpygLG8teyrnIVOMAWSqlT8JAsXtPNaBtjPHDwyazfZrvEmEk51JD\nX0tA8M5ah1NYt+r5JaKNxp3P/8wUT6lyszyoeubWJsnFRfSusuq/NRC+1+KDg/aq\nKnSBu7QGbm9JoT2RrmBv5RECgYBRn8Lj1I1muvHTNDkiuRj2VniOSirkUkA2/6y+\nPMKi+SS0tqcY63v4rNCYYTW1L7Yz8V44U5mJoQb4lvpMbolGhPljjxAAU3hVkItb\nvGVRlSCIZHKczADD4rJUDOS7DYxO3P1bjUN4kkyYx+lKUMDBHFzCa2D6Kgt4dobS\n5qYajQKBgQC7u7MFPkkEMqNqNGu5erytQkBq1v1Ipmf9rCi3iIj4XJLopxMgw0fx\n6jwcwNInl72KzoUBLnGQ9PKGVeBcgEgdI+a+tq+1TJo6Ta+hZSx+4AYiKY18eRKG\neNuER9NOcSVJ7Eqkcw4viCGyYDm2vgNV9HJ0VlAo3RDh8x5spEN+mg==\n-----END RSA PRIVATE KEY-----\n"
|
||||||
|
```
|
||||||
|
|
||||||
## Create a Pulsar instance
|
## Create a Pulsar instance
|
||||||
|
|
||||||
{{< tabs "Self-Hosted" "Kubernetes">}}
|
{{< tabs "Self-Hosted" "Kubernetes">}}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue