nats_messaging 0.0.5 → 0.1.0

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: 3ca8a44232bf1e4086d9cc5de329d1517d90bf9b6c774f2809c1bc71040667cc
4
- data.tar.gz: 3329ac2260d106ce8a96d48d18ee2e0f0396a87477a3ab5ae57e074ef94d0dc7
3
+ metadata.gz: d0909ed7e26fc66b8b91a32b90d046bcdbcad61a720ce06e385a7c17640bf3b4
4
+ data.tar.gz: e6105048114ccf0060ec9e8bdc72302aab8ef8ef5408aea48958c4311b4282be
5
5
  SHA512:
6
- metadata.gz: eddcac0f2150e306baebd4459bd97143b5c5b32920b5d3debaa5cfdc30af9107db4e7fee38f50759fa6e14c7328101094ec2a5232b4f5583ac66eb2b6176a9cf
7
- data.tar.gz: 81c8ea8e44349024eed7c6c8a860d795a187c71410bf0bd040677ad686bf211c1e551449c220f7ee8bdc57409e21e477fe1506bdd674e82dd0dc18d495e83429
6
+ metadata.gz: 7aea34415577fd2a0ea2d2c099de751fd41163d58429c4377f7a067c9cf8315ec4742bd909a0caed6622dd83b9e5a23a9d886f04e6290c1c099aba075f84235b
7
+ data.tar.gz: 075121def96c2501c3eb8f2d6df21ddf818101c4c2fd2dfe32f1ea8e845c2997131c19fea549f912f03be443ac1ff6fdfd85fa794be08d2154bbfad3bda89e25
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nats_messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bea Graboloza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-08 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A service to send and receive messages on a Rails application using NATS
14
14
  email: beatriz.graboloza@bpo-advisors.net
@@ -17,7 +17,6 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/nats_messaging.rb
20
- - lib/nats_messaging/nats_controller.rb
21
20
  - lib/nats_messaging/nats_service.rb
22
21
  homepage: https://rubygems.org/gems/nats_messaging
23
22
  licenses:
@@ -1,55 +0,0 @@
1
- class NatsController < ApplicationController
2
-
3
- def index
4
- @durable = false # Default value for the toggle
5
- end
6
-
7
- def publish_message
8
- subject = params[:subject]
9
- message = params[:message]
10
-
11
- nats_service = Rails.application.config.nats_service
12
- nats_service.publish_message(subject, message)
13
-
14
- flash[:notice] = "Message published to #{subject}."
15
- redirect_to root_path
16
- end
17
-
18
- def subscribe_to_subject
19
- subject = params[:subject]
20
-
21
- nats_service = Rails.application.config.nats_service
22
- nats_service.subscribe_to_subject(subject, "durable_#{subject}")
23
-
24
- flash[:notice] = "Subscribed to #{subject}"
25
- Rails.logger.info "Suscribed to #{subject}"
26
- redirect_to root_path
27
- end
28
-
29
- def send_request
30
- subject = params[:subject]
31
- message = params[:message]
32
-
33
- nats_service = NatsService.new
34
- reply = nats_service.send_request(subject, message)
35
-
36
- if reply
37
- flash[:notice] = "Reply received: #{reply}"
38
- else
39
- flash[:alert] = "No reply received for subject: #{subject}"
40
- end
41
-
42
- redirect_to root_path
43
- end
44
-
45
- def listen_and_reply
46
- subject = params[:subject]
47
- reply_message = params[:reply_message]
48
-
49
- nats_service = Rails.application.config.nats_service
50
- nats_service.listen_and_reply(subject, reply_message)
51
-
52
- flash[:notice] = "Listening for requests on #{subject} and replying with '#{reply_message}'"
53
- redirect_to root_path
54
- end
55
- end