hutch 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/README.md +12 -20
- data/hutch.gemspec +2 -1
- data/lib/hutch/broker.rb +9 -3
- data/lib/hutch/version.rb +1 -1
- data/spec/hutch/broker_spec.rb +5 -0
- data/spec/spec_helper.rb +11 -0
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ad7051316dda86d731e7422ebd9c126618210e3
|
4
|
+
data.tar.gz: e5a4e0fa91debe583046b45076b3373768c77d2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b7444175bfd7abbbe2219214506a1a884da83f4ba9e0182547acc65ce2e5285691cb786d04985e16be7cabee26acbf94d4e51052a30192f8fbf4cdafb9951f4
|
7
|
+
data.tar.gz: d0b377c4b5d9f695d0e247c456352209f5e8798d52a3e8c025c88dbdd1598280f6a2766fb7a49d4f5810f64ca0965a141a2a0bb069812d9ecf62d464a26039c4
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,34 +3,21 @@
|
|
3
3
|
Hutch is a Ruby library for enabling asynchronous inter-service communication
|
4
4
|
in a service-oriented architecture, using RabbitMQ.
|
5
5
|
|
6
|
-
|
7
|
-
## Project Maturity
|
8
|
-
|
9
|
-
Hutch is a relatively young project that was extracted from production systems.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
## Installation & Bundler Dependency
|
14
|
-
|
15
|
-
### Most Recent Release
|
16
|
-
|
17
6
|
[![Gem Version](https://badge.fury.io/rb/hutch.png)](http://badge.fury.io/rb/hutch)
|
18
|
-
|
19
|
-
|
7
|
+
[![Build Status](https://travis-ci.org/gocardless/hutch.png?branch=master)](https://travis-ci.org/gocardless/hutch)
|
8
|
+
[![Dependency Status](https://gemnasium.com/gocardless/hutch.png)](https://gemnasium.com/gocardless/hutch)
|
9
|
+
[![Code Climate](https://codeclimate.com/github/gocardless/hutch.png)](https://codeclimate.com/github/gocardless/hutch)
|
20
10
|
|
21
11
|
To install with RubyGems:
|
22
12
|
|
23
13
|
```
|
24
|
-
gem install hutch
|
14
|
+
$ gem install hutch
|
25
15
|
```
|
26
16
|
|
27
|
-
|
17
|
+
## Project Maturity
|
28
18
|
|
29
|
-
|
19
|
+
Hutch is a relatively young project that was extracted from production systems.
|
30
20
|
|
31
|
-
``` ruby
|
32
|
-
gem "hutch", "~> 0.5.1"
|
33
|
-
```
|
34
21
|
|
35
22
|
## Overview
|
36
23
|
|
@@ -95,6 +82,8 @@ usage: hutch [options]
|
|
95
82
|
--mq-host HOST Set the RabbitMQ host
|
96
83
|
--mq-port PORT Set the RabbitMQ port
|
97
84
|
--mq-tls Use TLS for the AMQP connection
|
85
|
+
--mq-tls-cert FILE Certificate for TLS client verification
|
86
|
+
--mq-tls-key FILE Private key for TLS client verification
|
98
87
|
--mq-exchange EXCHANGE Set the RabbitMQ exchange
|
99
88
|
--mq-vhost VHOST Set the RabbitMQ vhost
|
100
89
|
--mq-username USERNAME Set the RabbitMQ username
|
@@ -103,8 +92,8 @@ usage: hutch [options]
|
|
103
92
|
--mq-api-port PORT Set the RabbitMQ API port
|
104
93
|
--mq-api-ssl Use SSL for the RabbitMQ API
|
105
94
|
--config FILE Load Hutch configuration from a file
|
106
|
-
|
107
95
|
--require PATH Require a Rails app or path
|
96
|
+
--[no-]autoload-rails Require the current rails app directory
|
108
97
|
-q, --quiet Quiet logging
|
109
98
|
-v, --verbose Verbose logging
|
110
99
|
--version Print the version and exit
|
@@ -196,3 +185,6 @@ are recommended.
|
|
196
185
|
[pc-issue]: https://github.com/ruby-amqp/amqp/issues/92
|
197
186
|
[pc-gist]: https://gist.github.com/3042381
|
198
187
|
|
188
|
+
---
|
189
|
+
|
190
|
+
GoCardless ♥ open source. If you do too, come [join us](https://gocardless.com/jobs/backend_developer).
|
data/hutch.gemspec
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require File.expand_path('../lib/hutch/version', __FILE__)
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.add_runtime_dependency 'bunny', '
|
4
|
+
gem.add_runtime_dependency 'bunny', '~> 1.0.0'
|
5
5
|
gem.add_runtime_dependency 'carrot-top', '~> 0.0.7'
|
6
6
|
gem.add_runtime_dependency 'multi_json', '~> 1.5'
|
7
7
|
gem.add_development_dependency 'rspec', '~> 2.12.0'
|
8
|
+
gem.add_development_dependency 'simplecov', '~> 0.7.1'
|
8
9
|
|
9
10
|
gem.name = 'hutch'
|
10
11
|
gem.summary = 'Easy inter-service communication using RabbitMQ.'
|
data/lib/hutch/broker.rb
CHANGED
@@ -148,7 +148,7 @@ module Hutch
|
|
148
148
|
@channel.ack(delivery_tag, false)
|
149
149
|
end
|
150
150
|
|
151
|
-
def publish(routing_key, message)
|
151
|
+
def publish(routing_key, message, properties = {})
|
152
152
|
payload = JSON.dump(message)
|
153
153
|
|
154
154
|
unless @connection
|
@@ -165,9 +165,15 @@ module Hutch
|
|
165
165
|
raise PublishError, msg
|
166
166
|
end
|
167
167
|
|
168
|
+
non_overridable_properties = {
|
169
|
+
routing_key: routing_key, timestamp: Time.now.to_i
|
170
|
+
}
|
171
|
+
properties[:message_id] ||= generate_id
|
172
|
+
|
168
173
|
logger.info("publishing message '#{message.inspect}' to #{routing_key}")
|
169
|
-
@exchange.publish(payload,
|
170
|
-
|
174
|
+
@exchange.publish(payload, {persistent: true}.
|
175
|
+
merge(properties).
|
176
|
+
merge(non_overridable_properties))
|
171
177
|
end
|
172
178
|
|
173
179
|
private
|
data/lib/hutch/version.rb
CHANGED
data/spec/hutch/broker_spec.rb
CHANGED
@@ -144,6 +144,11 @@ describe Hutch::Broker do
|
|
144
144
|
broker.exchange.should_receive(:publish).once
|
145
145
|
broker.publish('test.key', 'message')
|
146
146
|
end
|
147
|
+
|
148
|
+
it "allows passing message properties" do
|
149
|
+
broker.exchange.should_receive(:publish).once
|
150
|
+
broker.publish('test.key', 'message', {expiration: "2000", persistent: false})
|
151
|
+
end
|
147
152
|
end
|
148
153
|
|
149
154
|
context 'without a valid connection' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
if ENV['TRAVIS']
|
3
|
+
require 'coveralls'
|
4
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
5
|
+
end
|
6
|
+
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter '/spec/'
|
9
|
+
add_filter '/.bundle/'
|
10
|
+
end
|
11
|
+
|
1
12
|
require 'raven'
|
2
13
|
require 'hutch'
|
3
14
|
require 'logger'
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hutch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Marr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: carrot-top
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.12.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.7.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.7.1
|
69
83
|
description: Hutch is a Ruby library for enabling asynchronous inter-service communication
|
70
84
|
using RabbitMQ.
|
71
85
|
email:
|
@@ -76,6 +90,7 @@ extensions: []
|
|
76
90
|
extra_rdoc_files: []
|
77
91
|
files:
|
78
92
|
- .gitignore
|
93
|
+
- .travis.yml
|
79
94
|
- CHANGELOG.md
|
80
95
|
- Gemfile
|
81
96
|
- Guardfile
|