mimi-messaging 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mimi/messaging/request.rb +1 -1
- data/lib/mimi/messaging/version.rb +1 -1
- data/lib/tasks/console_ext.rake +6 -0
- data/lib/tasks/console_helpers.rb +47 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efb706ab9b5c7aabdc045daae8c0bc853ec90ee0
|
4
|
+
data.tar.gz: f2fea72a66862098269be871477f8944eee32057
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19175272ba5d1668275ae9393c57aeec3da1910c8cb26c7680337639d8735824396655cf5fe0d8497a92a62984f901c5a9c0cbea46c4f60aa7dcf879bede40ff
|
7
|
+
data.tar.gz: 53f9d5d8f5d5b74e96f8be48016a0ae693ba42fecd2d58550bf1ee25ee84e8cdfd711f434bae10b38c50a9442eaa0591b2da6fcfdb56aab62b2c34fcf4a09594
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Mimi::Messaging development console helpers
|
2
|
+
#
|
3
|
+
# get 'provider.name/method' [{param1: ..., param2: ...}]
|
4
|
+
# post 'provider.name/method' [{param1: ..., param2: ...}]
|
5
|
+
# listen 'notification.name'
|
6
|
+
# broadcast 'notification.name/method' [{param1: ..., param2: ...}]
|
7
|
+
#
|
8
|
+
def message_class_for(queue_name)
|
9
|
+
message_class = Class.new(Mimi::Messaging::Message)
|
10
|
+
message_class.queue(queue_name)
|
11
|
+
message_class
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(queue_and_method_name, params = {})
|
15
|
+
queue_name, method_name = queue_and_method_name.split('/')
|
16
|
+
message_class = message_class_for(queue_name)
|
17
|
+
puts "GET #{queue_name}/#{method_name}: #{params}"
|
18
|
+
ts = Time.now
|
19
|
+
result = message_class.get(method_name, params)
|
20
|
+
puts 'Completed in %.1fms' % ((Time.now - ts) * 1000.0)
|
21
|
+
result
|
22
|
+
end
|
23
|
+
|
24
|
+
def post(queue_and_method_name, params = {})
|
25
|
+
queue_name, method_name = queue_and_method_name.split('/')
|
26
|
+
message_class = message_class_for(queue_name)
|
27
|
+
puts "POST #{queue_name}/#{method_name}: #{params}"
|
28
|
+
message_class.post(method_name, params)
|
29
|
+
end
|
30
|
+
|
31
|
+
def listen(notification_name)
|
32
|
+
listener_class = Class.new(Mimi::Messaging::Listener)
|
33
|
+
listener_class.notification(notification_name)
|
34
|
+
listener_class.before do
|
35
|
+
logger.info "** #{request.canonical_name}: #{params}"
|
36
|
+
end
|
37
|
+
puts "Listener for '#{notification_name}' installed"
|
38
|
+
end
|
39
|
+
|
40
|
+
def broadcast(notification_and_method_name, params = {})
|
41
|
+
notification_name, method_name = notification_and_method_name.split('/')
|
42
|
+
notification_class = Class.new(Mimi::Messaging::Notification)
|
43
|
+
notification_class.notification(notification_name)
|
44
|
+
puts "BROADCAST #{notification_name}/#{method_name}: #{params}"
|
45
|
+
notification_class.broadcast(method_name, params)
|
46
|
+
nil
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mimi-messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Kukushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mimi-core
|
@@ -140,6 +140,8 @@ files:
|
|
140
140
|
- lib/mimi/messaging/request_processor/context.rb
|
141
141
|
- lib/mimi/messaging/request_processor/dsl.rb
|
142
142
|
- lib/mimi/messaging/version.rb
|
143
|
+
- lib/tasks/console_ext.rake
|
144
|
+
- lib/tasks/console_helpers.rb
|
143
145
|
- mimi-messaging.gemspec
|
144
146
|
homepage: https://github.com/kukushkin/mimi-messaging
|
145
147
|
licenses:
|