active_pubsub 0.0.3 → 0.0.4

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: f6d67467176a0be6bf12783385e9ccb215a61b9d
4
- data.tar.gz: dbef4a7b649425c4d1326f982970366f1ec297ec
3
+ metadata.gz: da7f9a48586c7b132198b137c527f7687f5231cf
4
+ data.tar.gz: 8af37fe38090cf6b7359ce55241b87b057e20764
5
5
  SHA512:
6
- metadata.gz: 0217c66e7d33a9acbb750c1c66617819431baf28033a5c2b373449172172ad2ceb88fe91b198a939b951e25454e9cf928079cf1b7f6d4dfc6351dcaeb966b658
7
- data.tar.gz: d64f92f24b55f9cb09336b96b00fc98d681ac54b7c859b6a945b2632df33fc1bb3499c581b01d03533b334d709df3d656c083c9cfaa46eee62751a2065876d6d
6
+ metadata.gz: e6a26480849a0cb7452bfeda855d2f25fbbdedb25f7fce8336111b3dc1b0cece05bd8c0078a2df8b609ba21b365e339501b6ca7cb1642d77571fd2cbea7c58dd
7
+ data.tar.gz: c451742d2d6e8043b073fafb2ac287b8e1982e16b9c1212eee36f0a862b8a864544eed0cb29d3ae3926fed6a7ac88ecd716a4cfd9796fa627a02bb798925249e
data/README.md CHANGED
@@ -98,6 +98,24 @@ Average processed (subscriber) messages/second: 100-150
98
98
 
99
99
  The throughput seems to be limited by the publisher mostly, from the very limited benchmarks thus far.
100
100
 
101
+ ### Connecting to rabbit
102
+
103
+ If you are running rabbit at different address or port, set address via ENV variable, i.e.
104
+
105
+ ```
106
+ RABBITMQ_URL=amqp://guest:guest@x.x.x.x:XXXX bundle exec subscriber start
107
+ ```
108
+
109
+ Or you can set via config
110
+
111
+ ``` ruby
112
+ ::ActivePubsub.configure do |config|
113
+ config.address = "amqp://guest:guest@x.x.x.x:XXXX"
114
+ end
115
+ ```
116
+
117
+ Its still really early in development cycle, so there may be issues running tests if you aren't running rabbit. Should probably fix that.
118
+
101
119
  ### Installation
102
120
 
103
121
  Add this line to your application's Gemfile:
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "active_attr"
22
- spec.add_dependency "celluloid", "~> 0.15.2"
22
+ spec.add_dependency "celluloid"
23
23
  spec.add_dependency "json"
24
24
  spec.add_dependency "bunny"
25
25
 
@@ -0,0 +1,23 @@
1
+ module ActivePubsub
2
+ module PublishWithSerializer
3
+ extend ActiveSupport::Concern
4
+
5
+ #todo: move this into separate gem
6
+
7
+ included do
8
+ class_attribute :publish_serializer
9
+ end
10
+
11
+ def serialized_resource
12
+ serialized_resource_attributes = self.class.publish_serializer.new(self).attributes
13
+ serialized_resource_attributes.merge!("changes" => changes) if self.changed?
14
+ ::Marshal.dump(serialized_resource_attributes)
15
+ end
16
+
17
+ module ClassMethods
18
+ def serialize_publish_with(klass)
19
+ self.publish_serializer = klass
20
+ end
21
+ end
22
+ end
23
+ end
@@ -25,7 +25,7 @@ module ActivePubsub
25
25
 
26
26
  def publish_updated_event
27
27
  record_updated_event = ::ActivePubsub::Event.new(self.class.exchange_key, "updated", serialized_resource)
28
-
28
+
29
29
  ::ActivePubsub.publish_event(record_updated_event)
30
30
  end
31
31
 
@@ -1,3 +1,3 @@
1
1
  module ActivePubsub
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/active_pubsub.rb CHANGED
@@ -56,4 +56,5 @@ require "active_pubsub/event"
56
56
  require "active_pubsub/publisher"
57
57
  require "active_pubsub/publishable"
58
58
  require "active_pubsub/subscriber"
59
+ require "active_pubsub/publish_with_serializer"
59
60
  require 'active_pubsub/railtie' if defined?(Rails)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Ayre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_attr
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: celluloid
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.15.2
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.15.2
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -300,6 +300,7 @@ files:
300
300
  - lib/active_pubsub/config.rb
301
301
  - lib/active_pubsub/connection.rb
302
302
  - lib/active_pubsub/event.rb
303
+ - lib/active_pubsub/publish_with_serializer.rb
303
304
  - lib/active_pubsub/publishable.rb
304
305
  - lib/active_pubsub/publisher.rb
305
306
  - lib/active_pubsub/railtie.rb