salesforce_streamer 2.0.0.rc2 → 2.0.0

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
  SHA256:
3
- metadata.gz: 62cda30f1dc4379de105485088cce3cb77a874c6b336465b05ebdc0976c46e60
4
- data.tar.gz: 8c470f3301875a1926dfc68e8b40cc3862d8478bbd95c97fe4cdd154c0bd3c05
3
+ metadata.gz: 10b71d8f30b4e9eedff2ecabc48ec52d71f276abec73808f80c87d810d3307bb
4
+ data.tar.gz: 377f0fcaf7ccf7c44d1eaf615c12fd9e9e6b5f0fb981cd3e8268db4190c7cb23
5
5
  SHA512:
6
- metadata.gz: c8a7aee18710329e556852c68aeb626e587108f788acf880aa0810671b9c536517ee34798eb1e9a8fd03a67ff2e8171f59ddf1ab8da9b4f836f57b5cf3746015
7
- data.tar.gz: 4c91a95c717ece055e22e05b487994293c2015f04633e0d46676f2a740986345762c8d263f40f57b981ebc18ab76553dbc7252ad2ebe95ea415ff6b533eba7f6
6
+ metadata.gz: 59b6418e352e58af09b4e7ba6068bebed370af67feb896d3f0bba73ca1a8741b0bf73d3e67f2ad5dfe0c846694de311e877f0732672d6525cc565b93ffe507c7
7
+ data.tar.gz: 6d4d7dfd2baeb69fb0e7c1487a6ded133a7ab9ec4bcbd6c43a4615ceadeadd2b52df780719bef5a7fa34d96d9fed962a8c2a8d916b1e558c62657c0c4948983e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- salesforce_streamer (2.0.0.rc2)
4
+ salesforce_streamer (2.0.0)
5
5
  dry-initializer (~> 3.0)
6
6
  faye (~> 1.4)
7
7
  restforce (>= 4.2, < 6.0)
@@ -60,7 +60,7 @@ GEM
60
60
  rainbow (3.0.0)
61
61
  rake (13.0.1)
62
62
  regexp_parser (1.7.1)
63
- restforce (5.0.0)
63
+ restforce (5.0.1)
64
64
  faraday (>= 0.9.0, <= 2.0)
65
65
  faraday_middleware (>= 0.8.8, <= 2.0)
66
66
  hashie (>= 1.2.0, < 5.0)
data/README.md CHANGED
@@ -20,33 +20,11 @@ And then execute:
20
20
 
21
21
  ## Usage
22
22
 
23
- ### Middleware
24
-
25
- You can initialize the streamer server with any number of middleware classes.
26
- When a message is received by a PushTopic subscription, the chain of middleware
27
- classes are executed before the message handler is called.
28
-
29
- ```ruby
30
- # config/initializers/streamer.rb
31
- class MySimpleMiddleware
32
- def initialize(handler)
33
- @handler = handler
34
- end
35
- def call(message)
36
- @handler.call(message)
37
- end
38
- end
39
-
40
- SalesforceStreamer.config.use_middleware MySimpleMiddleware
41
- ```
42
-
43
23
  ### Configure Push Topics
44
24
 
45
- Create a YAML file to configure your server subscriptions. The configuration
46
- for each subscription must have a nested `salesforce:` key. These settings will
47
- be synced to your Salesforce instance when the `-x` flag is set on the command
48
- line. For more information about the `replay:` and `notify_fields_for` options
49
- please see the Salesforce Streaming API reference documentation.
25
+ Create a YAML file to configure your PushTopic subscriptions. When streamer
26
+ starts up it will check for any differences between Salesforce PushTopics and
27
+ this yaml and update any differences when `config.manage_topics = true`.
50
28
 
51
29
  ```yaml
52
30
  # config/streamer.yml
@@ -71,14 +49,6 @@ production:
71
49
  <<: *DEFAULT
72
50
  ```
73
51
 
74
- It's important to note that the way push topics are managed is by the Salesforce
75
- name attribute. This should uniquely identify each push topic. It is not
76
- recommended to change the name of your push topic definitions; otherwise, the
77
- push topic manager will not find a push topic in Salesforce resulting in the
78
- creation of a brand new push topic. If the push topic manager identifies a
79
- difference in any of the other Salesforce attributes, then it will update the
80
- push topic in Salesforce before starting the streaming server.
81
-
82
52
  ### Define Message Handlers
83
53
 
84
54
  Define your handlers somewhere in your project. They must respond to either
@@ -88,14 +58,17 @@ Define your handlers somewhere in your project. They must respond to either
88
58
  # lib/account_change_handler.rb
89
59
  # Handle account changes inline
90
60
  class AccountChangeHandler
91
- def self.call(message)
92
- puts message
61
+ class << self
62
+ def call(message)
63
+ puts message
64
+ end
93
65
  end
94
66
  end
95
67
 
96
68
  # Handle account changes asynchronously
97
69
  class AccountChangeHandler
98
70
  include Sidekiq::Worker
71
+
99
72
  def perform(message)
100
73
  puts message
101
74
  end
@@ -117,7 +90,7 @@ SalesforceStreamer.configure do |config|
117
90
  config.logger = Logger.new(STDERR, level: 'INFO')
118
91
  config.exception_adapter = proc { |e| puts e }
119
92
  config.replay_adapter = proc { |topic|
120
- (Store.get(topic.name) || topic.replay).to_i
93
+ (ReplayStore.get(topic.name) || topic.replay).to_i
121
94
  }
122
95
  config.use_middleware AfterMessageReceived
123
96
  config.manage_topics = true
@@ -160,6 +133,26 @@ By default, the executable will load the YAML based on the `RACK_ENV` environmen
160
133
  variable, or default to `:development` if not set. You can override this by
161
134
  setting the `config.environment = :integration`
162
135
 
136
+ ### Message Handling Middleware
137
+
138
+ You can initialize the streamer server with any number of middleware classes.
139
+ When a message is received by a PushTopic subscription, the chain of middleware
140
+ classes are executed before the message handler is called.
141
+
142
+ ```ruby
143
+ # config/initializers/streamer.rb
144
+ class MySimpleMiddleware
145
+ def initialize(handler)
146
+ @handler = handler
147
+ end
148
+
149
+ def call(message)
150
+ @handler.call(message)
151
+ end
152
+ end
153
+
154
+ SalesforceStreamer.config.use_middleware MySimpleMiddleware
155
+ ```
163
156
  ## Development
164
157
 
165
158
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,3 +1,3 @@
1
1
  module SalesforceStreamer
2
- VERSION = '2.0.0.rc2'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.metadata['homepage_uri'] = spec.homepage
16
16
  spec.metadata['source_code_uri'] = spec.homepage
17
+ spec.metadata['documentation_uri'] = 'https://www.rubydoc.info/gems/salesforce_streamer'
17
18
 
18
19
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin/|spec/|\.rub)}) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce_streamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Serok
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-08-04 00:00:00.000000000 Z
12
+ date: 2020-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-initializer
@@ -202,6 +202,7 @@ licenses:
202
202
  metadata:
203
203
  homepage_uri: https://github.com/renofi/salesforce_streamer
204
204
  source_code_uri: https://github.com/renofi/salesforce_streamer
205
+ documentation_uri: https://www.rubydoc.info/gems/salesforce_streamer
205
206
  post_install_message:
206
207
  rdoc_options: []
207
208
  require_paths:
@@ -213,9 +214,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
214
  version: '2.6'
214
215
  required_rubygems_version: !ruby/object:Gem::Requirement
215
216
  requirements:
216
- - - ">"
217
+ - - ">="
217
218
  - !ruby/object:Gem::Version
218
- version: 1.3.1
219
+ version: '0'
219
220
  requirements: []
220
221
  rubygems_version: 3.1.2
221
222
  signing_key: