salesforce_streamer 0.4.1 → 0.5.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: 6153a99dd0b80bf1ae73566587142a60feaa146997463dec701fa7b5ab8a41a4
4
- data.tar.gz: 643b43b8992df9049e0381aafdea57f30ac50b4cd37c67dfb2ba492d6a17d7b9
3
+ metadata.gz: eff82bf75f314377e4d2e28b6dba4f4ef24ce44203559628036b1db8c2902348
4
+ data.tar.gz: dfa56f925fa54697be822a7a4fa5ea05729048700a31f4883ff7b596a5b8898c
5
5
  SHA512:
6
- metadata.gz: bcb0ee78275961af564ee2ddc4e18878cb045f7e7266b790b7c16bb81fd3ab5abb2fca175919efb51c431e72463f7014d978e855774127ed64b1b06243896311
7
- data.tar.gz: 87a8da182c491f2e5c74cbb881d40954bf43e228a78b4f2abe87f2a3a1cc7367700815639e05c10291d283e2dc6fe63acf1b8498abde7372ff13e432a1cd7931
6
+ metadata.gz: d988b2783a28c3f9f1a5ffa81d15db40d27edf151b6d138e4ba5824af30a77c3fa1ecfa1302ba58d517515216789f386f9311c0e403fc549a4dcac978e25e81f
7
+ data.tar.gz: f15c679b13be777e89a2cd95723403f4716e35dd35ef8920ee1571492a7e1ae3feb161975810ea93688814ceb7b3d95e9a82b720d31be48c5b1b24b4df20712d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- salesforce_streamer (0.4.1)
4
+ salesforce_streamer (0.5.0)
5
5
  faye (= 0.8.9)
6
6
  restforce (~> 4.2)
7
7
 
@@ -7,6 +7,7 @@ require 'forwardable'
7
7
 
8
8
  require 'salesforce_streamer/configuration'
9
9
  require 'salesforce_streamer/errors'
10
+ require 'salesforce_streamer/replay_id_error_extension'
10
11
  require 'salesforce_streamer/log'
11
12
  require 'salesforce_streamer/push_topic'
12
13
  require 'salesforce_streamer/topic_manager'
@@ -1,4 +1,6 @@
1
1
  module SalesforceStreamer
2
+ ReplayIdError = Class.new(StandardError)
3
+
2
4
  class MissingCLIFlagError < StandardError
3
5
  def initialize(flag)
4
6
  super 'Missing required command line flag: ' + flag.to_s
@@ -0,0 +1,13 @@
1
+ module SalesforceStreamer
2
+ class ReplayIdErrorExtension
3
+ REPLAY_ERROR_REGEX = /^400::The replayId /.freeze
4
+
5
+ def incoming(message, callback)
6
+ if message['error']&.match?(REPLAY_ERROR_REGEX)
7
+ fail ReplayIdError, message['error']
8
+ end
9
+
10
+ callback.call message
11
+ end
12
+ end
13
+ end
@@ -24,7 +24,11 @@ module SalesforceStreamer
24
24
  end
25
25
 
26
26
  def client
27
- Restforce.new.tap(&:authenticate!)
27
+ return @client if @client
28
+ @client = Restforce.new
29
+ @client.authenticate!
30
+ @client.faye.add_extension ReplayIdErrorExtension.new
31
+ @client
28
32
  end
29
33
 
30
34
  def start_em
@@ -1,3 +1,3 @@
1
1
  module SalesforceStreamer
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce_streamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Serok
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-05 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye
@@ -154,6 +154,7 @@ files:
154
154
  - lib/salesforce_streamer/message_receiver.rb
155
155
  - lib/salesforce_streamer/push_topic.rb
156
156
  - lib/salesforce_streamer/redis_replay.rb
157
+ - lib/salesforce_streamer/replay_id_error_extension.rb
157
158
  - lib/salesforce_streamer/replay_persistence.rb
158
159
  - lib/salesforce_streamer/salesforce_client.rb
159
160
  - lib/salesforce_streamer/server.rb