Skip to content

Commit

Permalink
refactor: clarify where the event name usually comes from
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Feb 18, 2025
1 parent 77146a3 commit 34562b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/how-tos/create-a-new-event.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ The :term:`Event Definition` should be implemented in the corresponding subdomai
- The event definition should be documented using in-line documentation with at least ``event_type``, ``event_name``, ``event_key_field``, ``event_description``, ``event_data`` and ``event_trigger_repository``. This will help consumers understand the event and react to it. See :doc:`../reference/in-line-code-annotations-for-an-event` for more information.
- The :term:`Event Type` should be unique and follow the naming convention for event types specified in the :doc:`../decisions/0002-events-naming-and-versioning` ADR. This is used by consumers to identify the event.
- The ``event_name`` should be a constant that is used to identify the event in the code.
- The ``event_name`` should be the variable name storing the event instance used to trigger the event. The name of the variable usually matches the ``{Subject}_{Action}`` of the event type. See more about the name in the :doc:`../decisions/0002-events-naming-and-versioning` ADR.
- The ``event_key_field`` should be a field in the payload that uniquely identifies the event. This is used by consumers to identify the event.
- The ``event_description`` should describe what the event is about and why it is triggered.
- The ``event_data`` should be the payload class that is used to define the data that is included in the event.
Expand Down
10 changes: 5 additions & 5 deletions docs/reference/in-line-code-annotations-for-an-event.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ Consider the following example:
In-line code annotations are also used when integrating the event into the service.

+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Annotation | Description |
+=====================================+============================================================================================================================+
| event_implemented_name (Required) | Name of the event that is being implemented. Use the variable name of the event instance. |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Annotation | Description |
+===================================+===========================================================================================================================================================+
| event_implemented_name (Required) | Variable name storing the event instance used to trigger the event. The name of the variable usually matches the``{Subject}_{Action}`` of the event type. |
+-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+

Consider the following example:

Expand Down

0 comments on commit 34562b1

Please sign in to comment.