magellan-publisher 0.0.3 → 0.0.4
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 +4 -4
- data/lib/magellan/publisher.rb +4 -3
- data/lib/magellan/publisher/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4effeb9d0a441dd116af6b7d85297e70687411e4
|
4
|
+
data.tar.gz: feb34baac7ff902bfe5dba4031ec9ef66318fd78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fc14f652a92b431d6698f5aae430ce75d88538b6f104e7cea32d565ae3573e7545694d98ea468baf1c25d8d791b020edd833a131c521bbd422b4e3ce8570894
|
7
|
+
data.tar.gz: bb999eae590bdafc96d4cb9d59789d676541325df051e6bc74885dacfcbe97e9add7e71e3079bf10cd74b70751ec6a72e6855187eee88de98301b4da2a8f91de
|
data/lib/magellan/publisher.rb
CHANGED
@@ -27,8 +27,9 @@ module Magellan
|
|
27
27
|
# publish message size limit
|
28
28
|
@message_size_limit = load_env_as_default(nil, ["MAGELLAN_PUBLISH_MESSAGE_SIZE_LIMIT"], :integer) || (256 * 1024 * 1024)
|
29
29
|
# message size limit should be treated equally with MQTT message.
|
30
|
-
# substruct MQTT's topic length
|
31
|
-
|
30
|
+
# substruct MQTT's topic length (2 bytes)
|
31
|
+
# currently magellan-publisher can publish message only in QoS=0 mode. so packet identifier record is not included in a packet.
|
32
|
+
@message_size_limit -= 2
|
32
33
|
end
|
33
34
|
|
34
35
|
def convert_topic(mqtt_topic)
|
@@ -38,7 +39,7 @@ module Magellan
|
|
38
39
|
|
39
40
|
def publish(topic, body)
|
40
41
|
if topic.bytesize + body.bytesize > @message_size_limit
|
41
|
-
raise MessageTooLong, "publishing topic(#{topic.bytesize} bytes) and payload(#{body.bytesize}) exceed message size limitation#{@message_size_limit}."
|
42
|
+
raise MessageTooLong, "publishing topic(#{topic.bytesize} bytes) and payload(#{body.bytesize} bytes) exceed message size limitation(#{@message_size_limit} bytes)."
|
42
43
|
end
|
43
44
|
@exchange.publish(body, routing_key: convert_topic(topic))
|
44
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magellan-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomoyuki Chikanaga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.4.
|
120
|
+
rubygems_version: 2.4.5
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: ''
|