diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c33708..259339b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changes - Fix symbol json encoding breaking compatibility with some gems +### Added +- Added `event_data` property when sending event + ## [0.4.0] - 2019-03-25 ### Added - Calling `#dispatch` on tasks now allows to process tasks asynchronously diff --git a/lib/zenaton/client.rb b/lib/zenaton/client.rb index 56cdfdd..2f43ab8 100644 --- a/lib/zenaton/client.rb +++ b/lib/zenaton/client.rb @@ -33,8 +33,9 @@ class Client PROG = 'Ruby' # The current programming language - EVENT_INPUT = 'event_input' # Parameter name for event data + EVENT_INPUT = 'event_input' # Parameter name for event input EVENT_NAME = 'event_name' # Parameter name for event name + EVENT_DATA = 'event_data' # Parameter name for event data WORKFLOW_KILL = 'kill' # Worker update mode to stop a worker WORKFLOW_PAUSE = 'pause' # Worker udpate mode to pause a worker @@ -174,7 +175,8 @@ def send_event(workflow_name, custom_id, event) ATTR_NAME => workflow_name, ATTR_ID => custom_id, EVENT_NAME => event.class.name, - EVENT_INPUT => @serializer.encode(@properties.from(event)) + EVENT_INPUT => @serializer.encode(@properties.from(event)), + EVENT_DATA => @serializer.encode(event) } @http.post(send_event_url, body) end diff --git a/spec/zenaton/client_spec.rb b/spec/zenaton/client_spec.rb index 3ee17d7..fadcad3 100644 --- a/spec/zenaton/client_spec.rb +++ b/spec/zenaton/client_spec.rb @@ -418,7 +418,14 @@ 'name' => 'MyWorkflow', 'custom_id' => 'MyCustomId', 'event_name' => 'FakeEvent', - 'event_input' => { 'o' => '@zenaton#0', 's' => [{ 'a' => {} }] }.to_json + 'event_input' => { + 'o' => '@zenaton#0', + 's' => [{ 'a' => {} }] + }.to_json, + 'event_data' => { + 'o' => '@zenaton#0', + 's' => [{ 'n' => 'FakeEvent', 'p' => {} }] + }.to_json } end