Skip to content

Commit 046b563

Browse files
authored
Merge branch 'v1.12' into java_features
2 parents 1ce09df + 2aed48c commit 046b563

File tree

12 files changed

+2303
-15
lines changed

12 files changed

+2303
-15
lines changed

daprdocs/content/en/developing-applications/building-blocks/pubsub/pubsub-overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ For more information on message routing, read [Dapr pub/sub API reference]({{< r
9696

9797
Sometimes, messages can't be processed because of a variety of possible issues, such as erroneous conditions within the producer or consumer application or an unexpected state change that causes an issue with your application code. Dapr allows developers to set dead letter topics to deal with messages that cannot be delivered to an application. This feature is available on all pub/sub components and prevents consumer applications from endlessly retrying a failed message. For more information, read about [dead letter topics]({{< ref "pubsub-deadletter.md">}})
9898

99+
### Enabling the outbox pattern
100+
101+
Dapr enables developers to use the outbox pattern for achieving a single transaction across a transactional state store and any message broker. For more information, read [How to enable transactional outbox messaging]({{< ref howto-outbox.md >}})
102+
99103
### Namespace consumer groups
100104

101105
Dapr solves multi-tenancy at-scale with [namespaces for consumer groups]({{< ref howto-namespace >}}). Simply include the `"{namespace}"` value in your component metadata for consumer groups to allow multiple namespaces with applications of the same `app-id` to publish and subscribe to the same message broker.

daprdocs/content/en/developing-applications/building-blocks/service-invocation/howto-invoke-non-dapr-endpoints.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,52 @@ localhost:3500/v1.0/invoke/<appID>/method/<my-method>
7979
curl http://localhost:3602/v1.0/invoke/orderprocessor/method/checkout
8080
```
8181

82+
## TLS authentication
83+
84+
Using the [HTTPEndpoint resource]({{< ref httpendpoints-schema.md >}}) allows you to use any combination of a root certificate, client certificate and private key according to the authentication requirements of the remote endpoint.
85+
86+
### Example using root certificate
87+
88+
```yaml
89+
apiVersion: dapr.io/v1alpha1
90+
kind: HTTPEndpoint
91+
metadata:
92+
name: "external-http-endpoint-tls"
93+
spec:
94+
baseUrl: https://service-invocation-external:443
95+
headers:
96+
- name: "Accept-Language"
97+
value: "en-US"
98+
clientTLS:
99+
rootCA:
100+
secretKeyRef:
101+
name: dapr-tls-client
102+
key: ca.crt
103+
```
104+
105+
### Example using client certificate and private key
106+
107+
```yaml
108+
apiVersion: dapr.io/v1alpha1
109+
kind: HTTPEndpoint
110+
metadata:
111+
name: "external-http-endpoint-tls"
112+
spec:
113+
baseUrl: https://service-invocation-external:443
114+
headers:
115+
- name: "Accept-Language"
116+
value: "en-US"
117+
clientTLS:
118+
certificate:
119+
secretKeyRef:
120+
name: dapr-tls-client
121+
key: tls.crt
122+
privateKey:
123+
secretKeyRef:
124+
name: dapr-tls-key
125+
key: tls.key
126+
```
127+
82128
## Related Links
83129
84130
- [HTTPEndpoint reference]({{< ref httpendpoints-schema.md >}})
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
type: docs
3+
title: "How-To: Enable the transactional outbox pattern"
4+
linkTitle: "How-To: Enable the transactional outbox pattern"
5+
weight: 400
6+
description: "Commit a single transaction across a state store and pub/sub message broker"
7+
---
8+
9+
The transactional outbox pattern is a well known design pattern for sending notifications regarding changes in an application's state. The transactional outbox pattern uses a single transaction that spans across the database and the message broker delivering the notification.
10+
11+
Developers are faced with many difficult technical challenges when trying to implement this pattern on their own, which often involves writing error-prone central coordination managers that, at most, support a combination of one or two databases and message brokers.
12+
13+
For example, you can use the outbox pattern to:
14+
1. Write a new user record to an account database.
15+
1. Send a notification message that the account was successfully created.
16+
17+
With Dapr's outbox support, you can notify subscribers when an application's state is created or updated when calling Dapr's [transactions API]({{< ref "state_api.md#state-transactions" >}}).
18+
19+
The diagram below is an overview of how the outbox feature works:
20+
21+
1) Service A saves/updates state to the state store using a transaction.
22+
2) A message is written to the broker under the same transaction. When the message is successfully delivered to the message broker, the transaction completes, ensuring the state and message are transacted together.
23+
3) The message broker delivers the message topic to any subscribers - in this case, Service B.
24+
25+
<img src="/images/state-management-outbox.png" width=800 alt="Diagram showing the steps of the outbox pattern">
26+
27+
## Requirements
28+
29+
The outbox feature can be used with using any [transactional state store]({{< ref supported-state-stores >}}) supported by Dapr. All [pub/sub brokers]({{< ref supported-pubsub >}}) are supported with the outbox feature.
30+
31+
{{% alert title="Note" color="primary" %}}
32+
Message brokers that work with the competing consumer pattern (for example, [Apache Kafka]({{< ref setup-apache-kafka>}}) are encouraged to reduce the chances of duplicate events.
33+
{{% /alert %}}
34+
35+
## Usage
36+
37+
To enable the outbox feature, add the following required and optional fields on a state store component:
38+
39+
```yaml
40+
apiVersion: dapr.io/v1alpha1
41+
kind: Component
42+
metadata:
43+
name: mysql-outbox
44+
spec:
45+
type: state.mysql
46+
version: v1
47+
metadata:
48+
- name: connectionString
49+
value: "<CONNECTION STRING>"
50+
- name: outboxPublishPubsub # Required
51+
value: "mypubsub"
52+
- name: outboxPublishTopic # Required
53+
value: "newOrder"
54+
- name: outboxPubsub # Optional
55+
value: "myOutboxPubsub"
56+
- name: outboxDiscardWhenMissingState #Optional. Defaults to false
57+
value: false
58+
```
59+
60+
### Metadata fields
61+
62+
| Name | Required | Default Value | Description |
63+
| --------------------|-------------|---------------|------------------------------------------------------- |
64+
| outboxPublishPubsub | Yes | N/A | Sets the name of the pub/sub component to deliver the notifications when publishing state changes
65+
| outboxPublishTopic | Yes | N/A | Sets the topic that receives the state changes on the pub/sub configured with `outboxPublishPubsub`. The message body will be a state transaction item for an `insert` or `update` operation
66+
| outboxPubsub | No | `outboxPublishPubsub` | Sets the pub/sub component used by Dapr to coordinate the state and pub/sub transactions. If not set, the pub/sub component configured with `outboxPublishPubsub` is used. This is useful if you want to separate the pub/sub component used to send the notification state changes from the one used to coordinate the transaction
67+
| outboxDiscardWhenMissingState | No | `false` | By setting `outboxDiscardWhenMissingState` to `true`, Dapr discards the transaction if it cannot find the state in the database and does not retry. This setting can be useful if the state store data has been deleted for any reason before Dapr was able to deliver the message and you would like Dapr to drop the items from the pub/sub and stop retrying to fetch the state
68+
69+
### Combining outbox and non-outbox messages on the same state store
70+
71+
If you want to use the same state store for sending both outbox and non-outbox messages, simply define two state store components that connect to the same state store, where one has the outbox feature and the other does not.
72+
73+
#### MySQL state store without outbox
74+
75+
```yaml
76+
apiVersion: dapr.io/v1alpha1
77+
kind: Component
78+
metadata:
79+
name: mysql
80+
spec:
81+
type: state.mysql
82+
version: v1
83+
metadata:
84+
- name: connectionString
85+
value: "<CONNECTION STRING>"
86+
```
87+
88+
#### MySQL state store with outbox
89+
90+
```yaml
91+
apiVersion: dapr.io/v1alpha1
92+
kind: Component
93+
metadata:
94+
name: mysql-outbox
95+
spec:
96+
type: state.mysql
97+
version: v1
98+
metadata:
99+
- name: connectionString
100+
value: "<CONNECTION STRING>"
101+
- name: outboxPublishPubsub # Required
102+
value: "mypubsub"
103+
- name: outboxPublishTopic # Required
104+
value: "newOrder"
105+
```
106+
107+
## Demo
108+
109+
Watch [this video for an overview of the outbox pattern](https://youtu.be/rTovKpG0rhY?t=1338):
110+
111+
<div class="embed-responsive embed-responsive-16by9">
112+
<iframe width="360" height="315" src="https://youtu.be/rTovKpG0rhY?t=1338" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

daprdocs/content/en/developing-applications/building-blocks/state-management/state-management-overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ Dapr enables states to be:
116116

117117
For more details read [How-To: Share state between applications]({{< ref howto-share-state.md >}}),
118118

119+
### Enabling the outbox pattern
120+
121+
Dapr enables developers to use the outbox pattern for achieving a single transaction across a transactional state store and any message broker. For more information, read [How to enable transactional outbox messaging]({{< ref howto-outbox.md >}})
122+
119123
### Querying state
120124

121125
There are two ways to query the state:

daprdocs/content/en/getting-started/quickstarts/bindings-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Let's take a look at Dapr's [Bindings building block]({{< ref bindings >}}). Usi
1111
- Trigger your app with events coming in from external systems.
1212
- Interface with external systems.
1313

14-
In this Quickstart, you will schedule a batch script to run every 10 seconds using an input [Cron]({{< ref cron.md >}}) binding. The script processes a JSON file and outputs data to a SQL database using the [PostgreSQL]({{< ref postgresql.md >}}) Dapr binding.
14+
In this Quickstart, you schedule a batch script to run every 10 seconds using an input [Cron]({{< ref cron.md >}}) binding. The script processes a JSON file and outputs data to a SQL database using the [PostgreSQL]({{< ref postgresql.md >}}) Dapr binding.
1515

1616
<img src="/images/bindings-quickstart/bindings-quickstart.png" width=800 style="padding-bottom:15px;">
1717

0 commit comments

Comments
 (0)