gorg_message_sender 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +164 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gorg_message_sender.gemspec +37 -0
- data/lib/gorg_message_sender.rb +71 -0
- data/lib/gorg_message_sender/configuration.rb +40 -0
- data/lib/gorg_message_sender/json_schema.rb +97 -0
- data/lib/gorg_message_sender/version.rb +3 -0
- metadata +164 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e68f2f686bf3eb417c77a14b7513c7c48bea617e
|
4
|
+
data.tar.gz: b4d09677ad706cb8479046b9293a584caabc173f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f90356b84fdc3bd72d61172c806253d8fdc01fe202a8bd35d5f2b75409fa5ab975b2196649da5bcd68712c514396de8766b5f4b3f7df4ddf556c8a047201385
|
7
|
+
data.tar.gz: 97daa3108e4ef78ed9c70416ce5d9d12da8c1c23be9a7071a622c0479e5b674e2ebb7940edc0b731c89d5cb570a8cd0c71105a7ef1c7a6d25c79f80e70a7d107
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Alexandre Narbonne
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
# GorgMessageSender
|
2
|
+
[![Code Climate](https://codeclimate.com/github/Zooip/gorg_message_sender/badges/gpa.svg)](https://codeclimate.com/github/Zooip/gorg_message_sender) [![Test Coverage](https://codeclimate.com/github/Zooip/gorg_message_sender/badges/coverage.svg)](https://codeclimate.com/github/Zooip/gorg_message_sender/coverage) [![Build Status](https://travis-ci.org/Zooip/gorg_message_sender.svg?branch=master)](https://travis-ci.org/Zooip/gorg_message_sender) [![Gem Version](https://badge.fury.io/rb/gorg_message_sender.svg)](https://badge.fury.io/rb/gorg_message_sender) [![Dependency Status](https://gemnasium.com/badges/github.com/Zooip/gorg_message_sender.svg)](https://gemnasium.com/github.com/Zooip/gorg_message_sender)
|
3
|
+
|
4
|
+
GorgMessageSender is a very simple RabbitMQ message sender using Gadz.org SOA JSON Schema
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'gorg_message_sender'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install gorg_message_sender
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
###Configuration
|
24
|
+
GorgMessageSender can be configure to change its default values :
|
25
|
+
```ruby
|
26
|
+
GorgMessageSender.configure do |c|
|
27
|
+
|
28
|
+
# Id used to set the event_sender_id
|
29
|
+
#c.application_id = "gms"
|
30
|
+
|
31
|
+
# RabbitMQ network and authentification
|
32
|
+
#c.host = "localhost"
|
33
|
+
#c.port = 5672
|
34
|
+
#c.vhost = "/"
|
35
|
+
#c.user = nil
|
36
|
+
#c.password = nil
|
37
|
+
|
38
|
+
# Exchange configuration
|
39
|
+
#c.exchange_name ="exchange"
|
40
|
+
#c.durable_exchange= true
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
This based configuration can be overridden when needed :
|
45
|
+
```ruby
|
46
|
+
sender=GorgMessageSender.new(host: "my_host",
|
47
|
+
port: 1234,
|
48
|
+
user: "My_user",
|
49
|
+
pass: "1zae125a",
|
50
|
+
exchange_name: "some_exchange",
|
51
|
+
vhost: "/foo",
|
52
|
+
app_id: "bar",
|
53
|
+
durable_exchange: false)
|
54
|
+
```
|
55
|
+
###Generating a message
|
56
|
+
```ruby
|
57
|
+
sender=GorgMessageSender.new()
|
58
|
+
sender.message({this_is: "my data hash"},"some.routing.key")
|
59
|
+
|
60
|
+
# With default configuration
|
61
|
+
# => "{\"event_uuid\":\"095dcff6-665d-4194-bdfe-f889f8cedb09\",\"event_name\":\"some.routing.key\",\"event_creation_time\":\"2016-05-31T08:53:32+02:00\",\"event_sender_id\":\"gms\",\"data\":{\"this_is\":\"my data hash\"}}"
|
62
|
+
```
|
63
|
+
|
64
|
+
`event_uuid`, `event_creation_time` and `event_sender_id` can be overridden :
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
sender=GorgMessageSender.new()
|
68
|
+
|
69
|
+
sender.message({this_is: "my data hash"},
|
70
|
+
"some.routing.key",
|
71
|
+
event_uuid: "8c4abe62-26fe-11e6-b67b-9e71128cae77",
|
72
|
+
event_creation_time: DateTime.new(2084,05,10,01,57,00),
|
73
|
+
event_sender_id: "some_app_id"
|
74
|
+
)
|
75
|
+
# => "{\"event_uuid\":\"8c4abe62-26fe-11e6-b67b-9e71128cae77\",\"event_name\":\"some.routing.key\",\"event_creation_time\":\"2084-05-10T01:57:00+00:00\",\"event_sender_id\":\"some_app_id\",\"data\":{\"this_is\":\"my data hash\"}}"
|
76
|
+
```
|
77
|
+
###Message validation
|
78
|
+
By default, GorgMessageSender validate message against the Gadz.org SOA JSON Schema. You can force message generation for testing purpose with the option `skip_validation`
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
sender.message({this_is: "my data hash"},
|
82
|
+
"some.routing.key",
|
83
|
+
event_uuid: "this is not a valid uuid"
|
84
|
+
)
|
85
|
+
|
86
|
+
# With default configuration
|
87
|
+
# => RAISE JSON::Schema::ValidationError
|
88
|
+
|
89
|
+
sender.message({this_is: "my data hash"},
|
90
|
+
"some.routing.key",
|
91
|
+
event_uuid: "this is not a valid uuid",
|
92
|
+
skip_validation: true
|
93
|
+
)
|
94
|
+
|
95
|
+
# With default configuration
|
96
|
+
# => "{\"event_uuid\":\"this is not a valid uuid\",\"event_name\":\"some.routing.key\",\"event_creation_time\":\"2016-05-31T09:15:21+02:00\",\"event_sender_id\":\"gms\",\"data\":{\"this_is\":\"my data hash\"}}"
|
97
|
+
|
98
|
+
```
|
99
|
+
###Sending a message
|
100
|
+
To send a message, use the `send` command. It expects the same params than `message` :
|
101
|
+
```ruby
|
102
|
+
sender=GorgMessageSender.new(exchange_name: "my_exchange")
|
103
|
+
sender.send({this_is: "my data hash"},"some.routing.key")
|
104
|
+
|
105
|
+
# Message is sent to the exchange "my_exchange" with routing key "some.routing.key"
|
106
|
+
# => "{\"event_uuid\":\"095dcff6-665d-4194-bdfe-f889f8cedb09\",\"event_name\":\"some.routing.key\",\"event_creation_time\":\"2016-05-31T08:53:32+02:00\",\"event_sender_id\":\"gms\",\"data\":{\"this_is\":\"my data hash\"}}"
|
107
|
+
|
108
|
+
sender.send({this_is: "my data hash"},
|
109
|
+
"some.routing.key",
|
110
|
+
event_uuid: "8c4abe62-26fe-11e6-b67b-9e71128cae77",
|
111
|
+
event_creation_time: DateTime.new(2084,05,10,01,57,00),
|
112
|
+
event_sender_id: "some_app_id"
|
113
|
+
)
|
114
|
+
|
115
|
+
# Message is sent to the exchange "my_exchange" with routing key "some.routing.key"
|
116
|
+
# => "{\"event_uuid\":\"8c4abe62-26fe-11e6-b67b-9e71128cae77\",\"event_name\":\"some.routing.key\",\"event_creation_time\":\"2084-05-10T01:57:00+00:00\",\"event_sender_id\":\"some_app_id\",\"data\":{\"this_is\":\"my data hash\"}}"
|
117
|
+
|
118
|
+
|
119
|
+
sender.send({this_is: "my data hash"},
|
120
|
+
"some.routing.key",
|
121
|
+
event_uuid: "this is not a valid uuid"
|
122
|
+
)
|
123
|
+
|
124
|
+
# => RAISE JSON::Schema::ValidationError
|
125
|
+
|
126
|
+
|
127
|
+
sender.message({this_is: "my data hash"},
|
128
|
+
"some.routing.key",
|
129
|
+
event_uuid: "this is not a valid uuid",
|
130
|
+
skip_validation: true
|
131
|
+
)
|
132
|
+
|
133
|
+
# Message is sent to the exchange "my_exchange" with routing key "some.routing.key"
|
134
|
+
# => "{\"event_uuid\":\"this is not a valid uuid\",\"event_name\":\"some.routing.key\",\"event_creation_time\":\"2016-05-31T09:15:21+02:00\",\"event_sender_id\":\"gms\",\"data\":{\"this_is\":\"my data hash\"}}"
|
135
|
+
```
|
136
|
+
|
137
|
+
`send`also accepts the `verbose` params to print sending informations in SDOUT
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
sender.message({this_is: "my data hash"},
|
141
|
+
"some.routing.key",
|
142
|
+
event_uuid: "this is not a valid uuid",
|
143
|
+
verbose: true
|
144
|
+
)
|
145
|
+
```
|
146
|
+
|
147
|
+
##To Do
|
148
|
+
- Bunny error handling
|
149
|
+
- Allow sending messages in queues
|
150
|
+
|
151
|
+
## Development
|
152
|
+
|
153
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
154
|
+
|
155
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
156
|
+
|
157
|
+
## Contributing
|
158
|
+
|
159
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Zooip/gorg_message_sender.
|
160
|
+
|
161
|
+
|
162
|
+
## License
|
163
|
+
|
164
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gorg_message_sender"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gorg_message_sender/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gorg_message_sender"
|
8
|
+
spec.version = GorgMessageSender::VERSION
|
9
|
+
spec.authors = ["Alexandre Narbonne"]
|
10
|
+
spec.email = ["alexandre.narbonne@gadz.org"]
|
11
|
+
|
12
|
+
spec.summary = "A simple RabbitMQ message producer using Gadz.org JSON Schema policy"
|
13
|
+
spec.homepage = "https://github.com/Zooip/gorg_message_sender"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency 'bunny', '~> 2.2', '>= 2.2.2'
|
30
|
+
spec.add_dependency 'json-schema', '~> 2.6'
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.5.0"
|
36
|
+
spec.add_development_dependency 'bogus', '~> 0.1.6'
|
37
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "gorg_message_sender/version"
|
2
|
+
require "gorg_message_sender/configuration"
|
3
|
+
require "gorg_message_sender/json_schema"
|
4
|
+
require "bunny"
|
5
|
+
require "json"
|
6
|
+
require 'securerandom'
|
7
|
+
|
8
|
+
class GorgMessageSender
|
9
|
+
def initialize(host: self.class.configuration.host,
|
10
|
+
port: self.class.configuration.port,
|
11
|
+
user: self.class.configuration.user,
|
12
|
+
pass:self.class.configuration.password,
|
13
|
+
exchange_name:self.class.configuration.exchange_name,
|
14
|
+
vhost: self.class.configuration.vhost,
|
15
|
+
app_id: self.class.configuration.application_id,
|
16
|
+
durable_exchange: self.class.configuration.durable_exchange)
|
17
|
+
@r_host=host
|
18
|
+
@r_port=port
|
19
|
+
@r_user=user
|
20
|
+
@r_pass=pass
|
21
|
+
@r_exchange=exchange_name
|
22
|
+
@r_vhost=vhost
|
23
|
+
@app_id=app_id
|
24
|
+
@r_durable=durable_exchange
|
25
|
+
end
|
26
|
+
|
27
|
+
def message(data,routing_key, opts={})
|
28
|
+
json_msg={
|
29
|
+
"event_uuid" => opts[:event_uuid]||SecureRandom.uuid,
|
30
|
+
"event_name" => routing_key,
|
31
|
+
"event_creation_time" => (opts[:event_creation_time]&&(opts[:event_creation_time].respond_to?(:iso8601) ? opts[:event_creation_time].iso8601 : opts[:event_creation_time].to_s)) ||DateTime.now.iso8601,
|
32
|
+
"event_sender_id" => opts[:event_sender_id]|| @app_id,
|
33
|
+
"data"=> data,
|
34
|
+
}.to_json
|
35
|
+
JSON::Validator.validate!(GorgMessageSender::JSON_SCHEMA,json_msg) unless opts[:skip_validation]
|
36
|
+
json_msg
|
37
|
+
end
|
38
|
+
|
39
|
+
def send(data,routing_key,opts={})
|
40
|
+
self.start(verbose: opts[:verbose])
|
41
|
+
p_opts={}
|
42
|
+
p_opts[:routing_key]= routing_key if routing_key
|
43
|
+
msg=message(data,routing_key,opts)
|
44
|
+
@x.publish(msg, p_opts)
|
45
|
+
puts " [#] Message sent to exchange '#{@r_exchange}' (#{@r_durable ? "" : "not "}durable) with routing key '#{routing_key}'" if opts[:verbose]
|
46
|
+
self.stop(verbose: opts[:verbose])
|
47
|
+
msg
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
|
52
|
+
def start(opts)
|
53
|
+
@conn||=Bunny.new(
|
54
|
+
:hostname => @r_host,
|
55
|
+
:port => @r_port,
|
56
|
+
:user => @r_user,
|
57
|
+
:pass => @r_pass,
|
58
|
+
:vhost => @r_vhost
|
59
|
+
)
|
60
|
+
@conn.start
|
61
|
+
ch = @conn.create_channel
|
62
|
+
@x = ch.topic(@r_exchange, :durable => @r_durable)
|
63
|
+
puts " [#] Connected as user '#{@r_user}' to #{@r_host}:#{@r_port} on vhost '#{@r_vhost}'" if opts[:verbose]
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
def stop(opts)
|
68
|
+
@conn.close
|
69
|
+
puts " [#] Connection closed" if opts[:verbose]
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Add configuration features to GorgService
|
2
|
+
class GorgMessageSender
|
3
|
+
class << self
|
4
|
+
attr_writer :configuration
|
5
|
+
|
6
|
+
def configuration
|
7
|
+
@configuration ||= GorgMessageSender::Configuration.new
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def configure
|
12
|
+
@configuration = GorgMessageSender::Configuration.new
|
13
|
+
yield(configuration)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Hold configuration of GorgService in instance variables
|
18
|
+
class Configuration
|
19
|
+
attr_accessor :application_id,
|
20
|
+
:host,
|
21
|
+
:port,
|
22
|
+
:exchange_name,
|
23
|
+
:user,
|
24
|
+
:password,
|
25
|
+
:vhost,
|
26
|
+
:durable_exchange
|
27
|
+
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@application_id = "gms"
|
31
|
+
@host = "localhost"
|
32
|
+
@port = 5672
|
33
|
+
@exchange_name = "exchange"
|
34
|
+
@user = nil
|
35
|
+
@password = nil
|
36
|
+
@vhost = "/"
|
37
|
+
@durable_exchange = true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'json'
|
5
|
+
require 'json-schema'
|
6
|
+
|
7
|
+
class GorgMessageSender
|
8
|
+
|
9
|
+
JSON_SCHEMA = JSON.parse('{
|
10
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
11
|
+
"type": "object",
|
12
|
+
"properties": {
|
13
|
+
"event_name": {
|
14
|
+
"type": "string",
|
15
|
+
"pattern": "^[_a-z]+((\\.)?[_a-z]+)*$",
|
16
|
+
"description": "Event type. Must match the routing key"
|
17
|
+
},
|
18
|
+
"event_uuid": {
|
19
|
+
"type": "string",
|
20
|
+
"description": "The unique identifier of this message as UUID",
|
21
|
+
"pattern": "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
|
22
|
+
},
|
23
|
+
"event_creation_time": {
|
24
|
+
"type": "string",
|
25
|
+
"description": "Creation time in UTC ISO 8601 format",
|
26
|
+
"pattern": "^([\\\+-]?\\\d{4}(?!\\\d{2}\\\b))((-?)((0[1-9]|1[0-2])(\\\3([12]\\\d|0[1-9]|3[01]))?|W([0-4]\\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\\d|[12]\\\d{2}|3([0-5]\\\d|6[1-6])))([T\\\s]((([01]\\\d|2[0-3])((:?)[0-5]\\\d)?|24\\\:?00)([\\\.,]\\\d+(?!:))?)?(\\\17[0-5]\\\d([\\\.,]\\\d+)?)?([zZ]|([\\\+-])([01]\\\d|2[0-3]):?([0-5]\\\d)?)?)?)?$"
|
27
|
+
},
|
28
|
+
"event_sender_id": {
|
29
|
+
"type": "string",
|
30
|
+
"description": "Producer that sent the original message"
|
31
|
+
},
|
32
|
+
"data": {
|
33
|
+
"type": "object",
|
34
|
+
"description": "Data used to process this message"
|
35
|
+
},
|
36
|
+
"errors_count": {
|
37
|
+
"type": "integer",
|
38
|
+
"description": "Helper for counting errors"
|
39
|
+
},
|
40
|
+
"errors": {
|
41
|
+
"type": "array",
|
42
|
+
"items": {
|
43
|
+
"type": "object",
|
44
|
+
"properties": {
|
45
|
+
"error_type": {
|
46
|
+
"enum": [ "debug", "info", "warning", "softerror", "harderror" ],
|
47
|
+
"description": "Type of error."
|
48
|
+
},
|
49
|
+
"error_sender": {
|
50
|
+
"type": "string",
|
51
|
+
"description": "Consummer that sent this error"
|
52
|
+
},
|
53
|
+
"error_code":{
|
54
|
+
"type":"string",
|
55
|
+
"description": "Optionnal error code from the consummer"
|
56
|
+
},
|
57
|
+
"error_uuid":{
|
58
|
+
"type":"string",
|
59
|
+
"description": "The unique identifier of this error as UUID",
|
60
|
+
"pattern": "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
|
61
|
+
},
|
62
|
+
"error_message":{
|
63
|
+
"type":"string",
|
64
|
+
"description": "Error explanation"
|
65
|
+
},
|
66
|
+
"timestamp": {
|
67
|
+
"type": "string",
|
68
|
+
"description": "Time of occuring error in UTC ISO 8601",
|
69
|
+
"pattern": "^([\\\+-]?\\\d{4}(?!\\\d{2}\\\b))((-?)((0[1-9]|1[0-2])(\\\3([12]\\\d|0[1-9]|3[01]))?|W([0-4]\\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\\d|[12]\\\d{2}|3([0-5]\\\d|6[1-6])))([T\\\s]((([01]\\\d|2[0-3])((:?)[0-5]\\\d)?|24\\\:?00)([\\\.,]\\\d+(?!:))?)?(\\\17[0-5]\\\d([\\\.,]\\\d+)?)?([zZ]|([\\\+-])([01]\\\d|2[0-3]):?([0-5]\\\d)?)?)?)?$"
|
70
|
+
},
|
71
|
+
"error_debug": {
|
72
|
+
"type": "object",
|
73
|
+
"description": "Complementary informations for debugging"
|
74
|
+
}
|
75
|
+
},
|
76
|
+
"additionalProperties": false,
|
77
|
+
"required": [
|
78
|
+
"error_type",
|
79
|
+
"error_sender",
|
80
|
+
"timestamp",
|
81
|
+
"error_uuid",
|
82
|
+
"error_message"
|
83
|
+
]
|
84
|
+
}
|
85
|
+
}
|
86
|
+
},
|
87
|
+
"additionalProperties": false,
|
88
|
+
"required": [
|
89
|
+
"event_name",
|
90
|
+
"event_uuid",
|
91
|
+
"event_creation_time",
|
92
|
+
"event_sender_id",
|
93
|
+
"data"
|
94
|
+
]
|
95
|
+
}')
|
96
|
+
|
97
|
+
end
|
metadata
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gorg_message_sender
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexandre Narbonne
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bunny
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.2.2
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.2.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: json-schema
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.6'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.6'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.11'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.11'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '10.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '10.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: codeclimate-test-reporter
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.5.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.5.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: bogus
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.1.6
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.1.6
|
117
|
+
description:
|
118
|
+
email:
|
119
|
+
- alexandre.narbonne@gadz.org
|
120
|
+
executables: []
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files: []
|
123
|
+
files:
|
124
|
+
- ".gitignore"
|
125
|
+
- ".rspec"
|
126
|
+
- ".travis.yml"
|
127
|
+
- Gemfile
|
128
|
+
- LICENSE.txt
|
129
|
+
- README.md
|
130
|
+
- Rakefile
|
131
|
+
- bin/console
|
132
|
+
- bin/setup
|
133
|
+
- gorg_message_sender.gemspec
|
134
|
+
- lib/gorg_message_sender.rb
|
135
|
+
- lib/gorg_message_sender/configuration.rb
|
136
|
+
- lib/gorg_message_sender/json_schema.rb
|
137
|
+
- lib/gorg_message_sender/version.rb
|
138
|
+
homepage: https://github.com/Zooip/gorg_message_sender
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata:
|
142
|
+
allowed_push_host: https://rubygems.org
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.4.8
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: A simple RabbitMQ message producer using Gadz.org JSON Schema policy
|
163
|
+
test_files: []
|
164
|
+
has_rdoc:
|