Skip to content

Commit

Permalink
Merge pull request #9 from juliotrigo/update_docs
Browse files Browse the repository at this point in the history
Update license and readme
  • Loading branch information
juliotrigo authored Jan 25, 2019
2 parents 036c20d + 7f21c2b commit cdb0772
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2017, Sohonet Ltd.
Copyright (c) 2017-2019, Sohonet Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
26 changes: 16 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ Include the ``EventLogDispatcher`` dependency in your service class:
'foo_event_type', {'value': 1}, metadata={'meta': 2}
)
``event_type``, ``event_data`` (optional) and ``metadata`` (optional)
can be provided as arguments. Both ``event_data`` and ``metadata`` must
be dictionaries and contain JSON serializable data.

Calling ``foo_method`` will dispatch an event from the ``foo`` service
with ``log_event`` as the event type. However ``foo_event_type`` will be
the event type stored as part of the event metadata.

``event_type``, ``event_data`` (optional) and ``metadata`` (optional)
can be provided as arguments. Both ``event_data`` and ``metadata`` must
be dictionaries and contain JSON serializable data.

Then, any nameko service will be able to handle this event.

.. code-block:: python
Expand Down Expand Up @@ -100,23 +100,29 @@ This is the format of the event log data:
.. code-block:: python
{
"entrypoint_name": "foo_method",
"service_name": "foo",
"timestamp": "2017-06-12T13:48:16+00:00",
"event_type": "foo_event_type", # "entrypoint_fired", ...
"data": {},
"entrypoint_protocol": "Rpc",
"entrypoint_name": "foo_method",
"call_id": "foo.foo_method.d7e907ee-9425-48a6-84e6-89db19e3ce50",
"call_stack": [
"standalone_rpc_proxy.call.3f349ea4-ed3e-4a3b-93d0-a36fbf928ecb",
"bla.bla_method.21d623b4-edc4-4232-9957-4fad72533b75",
"foo.foo_method.d7e907ee-9425-48a6-84e6-89db19e3ce50"
],
"entrypoint_protocol": "Rpc",
"call_id": "foo.foo_method.d7e907ee-9425-48a6-84e6-89db19e3ce50"
"event_type": "foo_event_type", # "entrypoint_fired", ...
"timestamp": "2017-06-12T13:48:16+00:00",
"meta": 2, # extra information provided as "metadata"
"data": {"value": 1} # extra information provided as "event_data"
}
The ``data`` attribute will contain the event data that was provided as
an argument for the ``event_data`` parameter when dispatching the event.

If ``metadata`` was provided, then its elements will be included as top
level attributes in the event log data.


Tests
-----
Expand Down

0 comments on commit cdb0772

Please sign in to comment.