Skip to content

Commit a1bf39d

Browse files
authored
Merge pull request #556 from maykinmedia/feature/555-Send-zaakontkoppeld-events
[#555] Send zaak-ontkoppeld events
2 parents 77fd21b + 88530b5 commit a1bf39d

File tree

4 files changed

+444
-13
lines changed

4 files changed

+444
-13
lines changed

docs/functionality/cloud_events.rst

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Open Klant can emit cloud events when configured to do so via the
88

99
Currently, Open Klant emits the following cloud event:
1010

11-
* ``nl.overheid.zaken.zaak-gelinkt``: emitted when an ``Onderwerpobject`` is created that links to a
11+
* ``nl.overheid.zaken.zaak-gekoppeld``: emitted when an ``Onderwerpobject`` is created or updated that links to a
1212
Zaak (i.e. when ``codeObjecttype="zaak"`` in the ``onderwerpobjectidentificator`` field).
1313

1414
Cloud events are only sent when both of the following are true:
@@ -18,14 +18,14 @@ Cloud events are only sent when both of the following are true:
1818

1919
If either of these settings is missing, cloud events will **not** be emitted.
2020

21-
Example of a ``nl.overheid.zaken.zaak-gelinkt`` cloud event in its current shape:
21+
Example of a ``nl.overheid.zaken.zaak-gekoppeld`` cloud event in its current shape:
2222

2323
.. code-block:: json
2424
2525
{
2626
"specversion": "1.0",
27-
"type": "nl.overheid.zaken.zaak-gelinkt",
28-
"source": "urn:nld:oin:01823288444:openzaak",
27+
"type": "nl.overheid.zaken.zaak-gekoppeld",
28+
"source": "urn:nld:oin:01823288444:openklant",
2929
"subject": "a7b3c8d9-e4f5-6a7b-8c9d-e0f1a2b3c4d5",
3030
"id": "f347fd1f-dac1-4870-9dd0-f6c00edf4bf7",
3131
"time": "2025-10-10T00:00:00Z",
@@ -42,3 +42,37 @@ Example of a ``nl.overheid.zaken.zaak-gelinkt`` cloud event in its current shape
4242

4343
The shape of these cloud events and the actions that trigger them are still subject to
4444
change.
45+
46+
In addition to linking events, Open Klant can also emit *unlink* events when a Zaak
47+
is no longer related to an Onderwerpobject.
48+
49+
* ``nl.overheid.zaken.zaak-ontkoppeld``: emitted when a Zaak that was previously
50+
linked becomes unlinked. This happens when an ``Onderwerpobject`` that pointed
51+
to a Zaak is deleted, or otherwise changed such that the relationship with the
52+
Zaak disappears.
53+
54+
The payload of a ``nl.overheid.zaken.zaak-ontkoppeld`` event matches the shape of
55+
the original ``zaak-gekoppeld`` event so that Open Zaak can correctly identify
56+
and remove the corresponding ZaakObject relation.
57+
58+
Example of a ``nl.overheid.zaken.zaak-ontkoppeld`` cloud event:
59+
60+
.. code-block:: json
61+
62+
{
63+
"specversion": "1.0",
64+
"type": "nl.overheid.zaken.zaak-ontkoppeld",
65+
"source": "urn:nld:oin:01823288444:openklant",
66+
"subject": "a7b3c8d9-e4f5-6a7b-8c9d-e0f1a2b3c4d5",
67+
"id": "f347fd1f-dac1-4870-9dd0-f6c00edf4bf7",
68+
"time": "2025-10-10T00:00:00Z",
69+
"datacontenttype": "application/json",
70+
"data": {
71+
"zaak": "urn:uuid:a7b3c8d9-e4f5-6a7b-8c9d-e0f1a2b3c4d5",
72+
"linkTo": "http://open-klant.local:8000/klantinteracties/api/v1/onderwerpobjecten/5fee9673-216c-41e7-91d2-69a8d1526b9f",
73+
"label": "Mijn Klantcontact Onderwerp",
74+
"linkObjectType": "Onderwerpobject"
75+
}
76+
}
77+
78+
*Note:* The ``subject`` field again contains the UUID of the Zaak.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ZAAK_GEKOPPELD = "nl.overheid.zaken.zaak-gekoppeld"
2+
ZAAK_ONTKOPPELD = "nl.overheid.zaken.zaak-ontkoppeld"

0 commit comments

Comments
 (0)