Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

Commit

Permalink
Add 'event_data' property when sending event
Browse files Browse the repository at this point in the history
  • Loading branch information
François Guillot authored and MrYawe committed Jun 4, 2019
1 parent bf042b7 commit c5b5a83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/zenaton/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion spec/zenaton/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c5b5a83

Please sign in to comment.