promiscuous 0.10.1 → 0.11

Sign up to get free protection for your applications and to get access to all the features.
data/lib/promiscuous.rb CHANGED
@@ -10,6 +10,7 @@ module Promiscuous
10
10
  autoload :Subscriber, 'promiscuous/subscriber'
11
11
  autoload :Observer, 'promiscuous/observer'
12
12
  autoload :Worker, 'promiscuous/worker'
13
+ autoload :Ephemeral, 'promiscuous/ephemeral'
13
14
 
14
15
  class << self
15
16
  def configure(&block)
@@ -0,0 +1,13 @@
1
+ class Promiscuous::Ephemeral
2
+ def initialize(attributes)
3
+ attributes.each { |k, v| self.__send__("#{k}=", v) }
4
+ end
5
+
6
+ def self.create(attributes)
7
+ new(attributes).tap { |m| m.save }
8
+ end
9
+
10
+ def save
11
+ self.class.promiscuous_publisher.new(:instance => self).publish
12
+ end
13
+ end
@@ -12,6 +12,7 @@ module Promiscuous::Publisher
12
12
  autoload :Polymorphic, 'promiscuous/publisher/polymorphic'
13
13
  autoload :Worker, 'promiscuous/publisher/worker'
14
14
  autoload :Error, 'promiscuous/publisher/error'
15
+ autoload :Ephemeral, 'promiscuous/publisher/ephemeral'
15
16
 
16
17
  def self.lint(*args)
17
18
  Lint.lint(*args)
@@ -0,0 +1,9 @@
1
+ class Promiscuous::Publisher::Ephemeral < Promiscuous::Publisher::Base
2
+ include Promiscuous::Publisher::Class
3
+ include Promiscuous::Publisher::Attributes
4
+ include Promiscuous::Publisher::AMQP
5
+
6
+ def payload
7
+ super.merge(:operation => :create)
8
+ end
9
+ end
@@ -34,7 +34,7 @@ class Promiscuous::Publisher::Worker
34
34
  unless e.is_a?(Promiscuous::Publisher::Error)
35
35
  e = Promiscuous::Publisher::Error.new(e, nil)
36
36
  end
37
- Promiscuous.error "[publish] FATAL #{e}"
37
+ Promiscuous.error "[publish] FATAL #{e} #{e.backtrace}"
38
38
  Promiscuous::Config.error_handler.try(:call, e)
39
39
  end
40
40
  end
@@ -17,6 +17,7 @@ class Promiscuous::Subscriber::Worker
17
17
  # TODO Discuss with Arjun about having an error queue.
18
18
  self.stop = true
19
19
  Promiscuous::AMQP.disconnect
20
+ Promiscuous.error "[receive] FATAL #{e} #{e.backtrace.join("\n")}"
20
21
  Promiscuous.error "[receive] FATAL #{e}"
21
22
  Promiscuous::Config.error_handler.try(:call, e)
22
23
  end
@@ -1,3 +1,3 @@
1
1
  module Promiscuous
2
- VERSION = '0.10.1'
2
+ VERSION = '0.11'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promiscuous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: '0.11'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-10 00:00:00.000000000 Z
13
+ date: 2012-10-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -123,6 +123,7 @@ files:
123
123
  - lib/promiscuous/publisher/model.rb
124
124
  - lib/promiscuous/publisher/mongoid.rb
125
125
  - lib/promiscuous/publisher/worker.rb
126
+ - lib/promiscuous/publisher/ephemeral.rb
126
127
  - lib/promiscuous/railtie/replicate.rake
127
128
  - lib/promiscuous/subscriber/envelope.rb
128
129
  - lib/promiscuous/subscriber/error.rb
@@ -155,9 +156,10 @@ files:
155
156
  - lib/promiscuous/railtie.rb
156
157
  - lib/promiscuous/observer.rb
157
158
  - lib/promiscuous/common.rb
158
- - lib/promiscuous/publisher.rb
159
159
  - lib/promiscuous/subscriber.rb
160
160
  - lib/promiscuous/worker.rb
161
+ - lib/promiscuous/publisher.rb
162
+ - lib/promiscuous/ephemeral.rb
161
163
  - lib/promiscuous/version.rb
162
164
  - lib/promiscuous.rb
163
165
  - README.md