conduit icon indicating copy to clipboard operation
conduit copied to clipboard

Question: How to write into metadata field?

Open bumbus opened this issue 6 years ago • 2 comments

Hi, this might be a noobish question, but I could not figure out how to write into events.metadata. As I see it, maybe correct me if I am wrong, this would be the right place to save for example (phoenix) connection information like user IP etc.

Thanks fro advance.

bumbus avatar Nov 15 '18 10:11 bumbus

You can include any metadata during command dispatch. It will be copied onto any events created by the command.

ExampleRouter.dispatch(command,
  metadata: %{"issuer_id" => issuer_id, "user_id" => "[email protected]"}
)

Metadata is a useful place to record detais about the originating request (IP address, authenticated user id, etc.).

slashdotdash avatar Nov 15 '18 12:11 slashdotdash

thank you very much for helping out

bumbus avatar Nov 15 '18 12:11 bumbus