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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abb4f07cfdd36a2e31f638f8d7c5c95fdb51e81a
4
- data.tar.gz: 5ae47bd4b17f6ae58e5a42efe8c6828eb77d732e
3
+ metadata.gz: 0c7893d3190c5df63d59247cf2d1e0847c2538ad
4
+ data.tar.gz: 97e1d057baaa6019cfe609ef9c8f0454ad7df134
5
5
  SHA512:
6
- metadata.gz: c306ff04308ac13878e83a8a27ff9a4fd4f3ccb95a117bc8db8026cb341cab0f2539a06d5610b7e59b2495887a605a331042ce7ddfa5b80a4352096152f0ab8f
7
- data.tar.gz: 27b186f8b883e6a6ffea21635bd7963729c66671eee6ea3efee12fb9497e177b48e2885ce3e4f0796fbdf030c8a27f6381996f89b0157098e95b9acf85bea9e6
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/NeMO84/qwrapper.svg?branch=master)](https://travis-ci.org/NeMO84/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)
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
 
@@ -19,6 +19,7 @@ module Qwrapper
19
19
  end
20
20
 
21
21
  def config=(value)
22
+ @logger = value[:logger] if value.has_key?(:logger)
22
23
  @config = value
23
24
  end
24
25
 
@@ -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
@@ -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(ack: true, block: true) do |delivery_info, metadata, payload|
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
- queue.publish(message.to_s, :persistent => true)
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
@@ -1,3 +1,3 @@
1
1
  module Qwrapper
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
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.9
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: 2015-07-30 00:00:00.000000000 Z
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.2.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