angie-core-api 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a7c8cc2507395711eddac0862f0d5f79dfd8e3dd240659b9ba2fddaf7208011
|
4
|
+
data.tar.gz: c16d191db2e7cd8ba967de231ea4385f4793ccb2e4297db31e3053b9d32dc244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24d651097f6c55fb6f95fe0b73e7c3d7e0cb548c52f658390a965a2f88e19ea25dbf3cc298906a5867ec4576e83e352e20fb13a6aabfd6911b11fdab39fd01e9
|
7
|
+
data.tar.gz: dbab619970be170b35989973942afa90493e2dd0e0b8f1eb8982ecf91367f18dfd3d3f0305a6a2195dcdb8b70a74fb11bcefdf920470cb8b3f8c5b10c206f907
|
@@ -36,14 +36,13 @@ module AngieCoreApi
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.connect
|
39
|
-
|
40
|
-
classes.each { |k| k.new }
|
39
|
+
classes.each { |k| k.new } if instance.connection&.connected?
|
41
40
|
end
|
42
41
|
|
43
42
|
def self.disconnect!
|
44
|
-
|
43
|
+
instance.connection.close
|
45
44
|
@@instance = nil
|
46
|
-
puts "Disconnected from #{
|
45
|
+
puts "Disconnected from #{instance.amqp_url}"
|
47
46
|
end
|
48
47
|
|
49
48
|
private
|
@@ -4,6 +4,7 @@ module AngieCoreApi
|
|
4
4
|
module Messaging
|
5
5
|
class Exchange
|
6
6
|
def self.exchange(exchange_name, type:, routing_key:, queue: nil, exchange_options: {}, queue_options: {})
|
7
|
+
return unless AMQPClient.instance.connection&.connected?
|
7
8
|
channel = AMQPClient.instance.channel
|
8
9
|
@exchange_name = exchange_name
|
9
10
|
|
@@ -17,6 +18,7 @@ module AngieCoreApi
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def self.subscribe(options = { manual_ack: false })
|
21
|
+
return unless AMQPClient.instance.connection&.connected?
|
20
22
|
# TODO: show usage?
|
21
23
|
raise "Exchange is not defined" unless @exchange
|
22
24
|
raise "Queue is not defined" unless @queue
|
@@ -29,6 +31,7 @@ module AngieCoreApi
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.publish(payload, options = {})
|
34
|
+
return unless AMQPClient.instance.connection&.connected?
|
32
35
|
# TODO: show usage?
|
33
36
|
raise "Exchange is not defined" unless @exchange
|
34
37
|
raise "Routing key is not defined" unless options.has_key?(:routing_key)
|
@@ -9,8 +9,8 @@ module AngieCoreApi
|
|
9
9
|
end
|
10
10
|
|
11
11
|
initializer "angie_core_api.connect_to_messaging" do
|
12
|
-
ActiveSupport.on_load(:
|
13
|
-
|
12
|
+
ActiveSupport.on_load(:action_view) do
|
13
|
+
AngieCoreApi::Messaging::AMQPClient.connect
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angie-core-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nomadix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actioncable
|