qwrapper 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/qwrapper.rb +1 -0
- data/lib/qwrapper/message.rb +4 -2
- data/lib/qwrapper/queues/base.rb +6 -3
- data/lib/qwrapper/queues/rabbitmq.rb +4 -3
- data/lib/qwrapper/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c7893d3190c5df63d59247cf2d1e0847c2538ad
|
4
|
+
data.tar.gz: 97e1d057baaa6019cfe609ef9c8f0454ad7df134
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54067a1e4db1cd1b50b4b4ba691641293de1d00cc7e5c26301f6769162826dab97c54958ab55e802a6062f4c27a2332e42d89cee4ecab6309136ca29ae9ebc4c
|
7
|
+
data.tar.gz: 014b4ca37a74ffb1d38132cf7c5e2c7c2601e3b45a42f24c42415bbfe2279e6cb22accbdf6ea8c626b31e348630ff15104cc0178edcf6a191a683b9c0bf5a9c9
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Qwrapper
|
2
2
|
========
|
3
3
|
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/qwrapper.svg)](http://badge.fury.io/rb/qwrapper) [![Build Status](https://travis-ci.org/
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/qwrapper.svg)](http://badge.fury.io/rb/qwrapper) [![Build Status](https://travis-ci.org/patelify/qwrapper.svg?branch=master)](https://travis-ci.org/patelify/qwrapper) [![Dependency Status](https://gemnasium.com/NeMO84/qwrapper.svg)](https://gemnasium.com/NeMO84/qwrapper) [![Code Climate](https://codeclimate.com/github/NeMO84/qwrapper/badges/gpa.svg)](https://codeclimate.com/github/NeMO84/qwrapper) [![Test Coverage](https://codeclimate.com/github/NeMO84/qwrapper/badges/coverage.svg)](https://codeclimate.com/github/NeMO84/qwrapper)
|
5
5
|
|
6
6
|
QWrapper is an attempt to make queue systems like SQS, AMQP, Redis consisten when advanced features aren't necessary. When simple dequeue, enqueue, poll, subscribe actions are the primary interfaces used then abstracting the logic can really DRY up code and simplyify usage.
|
7
7
|
|
data/lib/qwrapper.rb
CHANGED
data/lib/qwrapper/message.rb
CHANGED
@@ -3,8 +3,6 @@ require 'json'
|
|
3
3
|
module Qwrapper
|
4
4
|
class Message
|
5
5
|
|
6
|
-
include Loggable
|
7
|
-
|
8
6
|
attr_reader :original_body, :hash
|
9
7
|
|
10
8
|
def initialize(body)
|
@@ -38,5 +36,9 @@ module Qwrapper
|
|
38
36
|
# TODO: Raise NotImplementedError? Client should implement their own custom error
|
39
37
|
end
|
40
38
|
|
39
|
+
def logger
|
40
|
+
Qwrapper.logger
|
41
|
+
end
|
42
|
+
|
41
43
|
end
|
42
44
|
end
|
data/lib/qwrapper/queues/base.rb
CHANGED
@@ -4,14 +4,11 @@ module Qwrapper
|
|
4
4
|
|
5
5
|
class Base
|
6
6
|
|
7
|
-
include Loggable
|
8
|
-
|
9
7
|
attr_accessor :config
|
10
8
|
attr_reader :requeue_errors, :requeue_lambda
|
11
9
|
|
12
10
|
def initialize(options)
|
13
11
|
@config = options
|
14
|
-
@logger = options[:logger] if options.has_key?(:logger)
|
15
12
|
end
|
16
13
|
|
17
14
|
def requeue_errors
|
@@ -28,6 +25,12 @@ module Qwrapper
|
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
28
|
+
private
|
29
|
+
|
30
|
+
def logger
|
31
|
+
Qwrapper.logger
|
32
|
+
end
|
33
|
+
|
31
34
|
end
|
32
35
|
|
33
36
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'bunny'
|
2
2
|
require 'qwrapper/queues/base'
|
3
3
|
|
4
|
-
|
5
4
|
module Qwrapper
|
6
5
|
|
7
6
|
module Queues
|
@@ -17,7 +16,7 @@ module Qwrapper
|
|
17
16
|
ch = connection.create_channel
|
18
17
|
ch.prefetch(options[:prefetch] || 1)
|
19
18
|
queue = ch.queue(queue_name, options.merge(durable: true))
|
20
|
-
queue.subscribe(
|
19
|
+
queue.subscribe(manual_ack: true, block: true) do |delivery_info, metadata, payload|
|
21
20
|
begin
|
22
21
|
if logger.respond_to?(:wrap)
|
23
22
|
logger_wrapped_block_execution(payload, &block)
|
@@ -52,7 +51,9 @@ module Qwrapper
|
|
52
51
|
ch.prefetch(options[:prefetch] || 1)
|
53
52
|
queue = ch.queue(queue_name, options.merge(durable: true))
|
54
53
|
messages.each do |message|
|
55
|
-
|
54
|
+
message_options = {persistent: true}
|
55
|
+
message_options.merge!(expiration: options[:expiration]) unless options[:expiration].nil?
|
56
|
+
queue.publish(message.to_s, message_options)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
rescue Exception => ex
|
data/lib/qwrapper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qwrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nirmit Patel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
172
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
173
|
+
rubygems_version: 2.6.4
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: QWrapper is an abstract API which makes working with different message queues
|