activemessaging 0.12.2 → 0.13.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
  SHA1:
3
- metadata.gz: f05d43c09bd5e33636c4b916952a0036c299b904
4
- data.tar.gz: 2a073f54521759315dda76d0434872f1f96d8732
3
+ metadata.gz: 745cf4dcd83298a2a575472d2da129aa1bd2ccd7
4
+ data.tar.gz: 3ab07801e599c5baa31d19865ed0aabcd92f23dd
5
5
  SHA512:
6
- metadata.gz: 598a0605d67d4a904a855341ac2c49f15fc0fc3ca36eb287eab8b94aacf57da122aba9f01516e78efeaa0ee6f55ccebd713bcfdab05ee637acff6e67850c5112
7
- data.tar.gz: 6b8ae9feed2d6c89929951e665e4eecfb937cc722377249b5a67e483900424fbd07514a2f4f94dff894d2a26d6f89211516cbf0e55db46743f2b36ae46bdb1e8
6
+ metadata.gz: 6393cae915d5ace65f376b441431ebbf8f7c3bec550b8718c159bbffb7e5d14552128eaf064e7fc3b47213d18e54783e6f3b698a10ab46845ae1f68c5dcf8710
7
+ data.tar.gz: 921d021a74156e8584f59af770a42cff70a2058e604f6e373c48f7b96f0d02b37d63fbcfc90873dddfd3dafe97d28ae7ae9de107754f993c2c5f9cfb8c3b5cd4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activemessaging (0.12.2)
4
+ activemessaging (0.13.0)
5
5
  activemessaging
6
6
  activesupport (>= 2.3.11)
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.2
1
+ 0.13.0
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: activemessaging 0.12.2 ruby lib
5
+ # stub: activemessaging 0.13.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "activemessaging"
9
- s.version = "0.12.2"
9
+ s.version = "0.13.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Jon Tirsen", "Andrew Kuklewicz", "Olle Jonsson", "Sylvain Perez", "Cliff Moon", "Uwe Kubosch", "Lance Cooper", "Matt Campbell"]
13
- s.date = "2014-06-05"
13
+ s.date = "2014-06-18"
14
14
  s.description = "ActiveMessaging is an attempt to bring the simplicity and elegance of rails development to the world of messaging. Messaging, (or event-driven architecture) is widely used for enterprise integration, with frameworks such as Java's JMS, and products such as ActiveMQ, Tibco, IBM MQSeries, etc. Now supporting Rails 3 as of version 0.8.0."
15
15
  s.email = "activemessaging-discuss@googlegroups.com"
16
16
  s.extra_rdoc_files = [
@@ -102,6 +102,7 @@ development:
102
102
  # content_type: text/plain
103
103
  # poll_interval: 1
104
104
  # cache_queue_list: true
105
+ # max_message_size: 8
105
106
 
106
107
 
107
108
  ########################################
@@ -18,14 +18,13 @@ module ActiveMessaging
18
18
  register :asqs
19
19
 
20
20
  QUEUE_NAME_LENGTH = 1..80
21
- MESSAGE_SIZE = 1..(8 * 1024)
22
21
  VISIBILITY_TIMEOUT = 0..(24 * 60 * 60)
23
22
  NUMBER_OF_MESSAGES = 1..255
24
23
  GET_QUEUE_ATTRIBUTES = ['All', 'ApproximateNumberOfMessages', 'VisibilityTimeout']
25
24
  SET_QUEUE_ATTRIBUTES = ['VisibilityTimeout']
26
25
 
27
26
  #configurable params
28
- attr_accessor :reconnectDelay, :access_key_id, :secret_access_key, :aws_version, :content_type, :host, :port, :poll_interval, :cache_queue_list
27
+ attr_accessor :reconnect_delay, :access_key_id, :secret_access_key, :aws_version, :content_type, :host, :port, :poll_interval, :cache_queue_list, :max_message_size
29
28
 
30
29
  #generic init method needed by a13g
31
30
  def initialize cfg
@@ -43,6 +42,9 @@ module ActiveMessaging
43
42
  @protocol = cfg[:protocol] || 'http'
44
43
  @poll_interval = cfg[:poll_interval] || 1
45
44
  @reconnect_delay = cfg[:reconnectDelay] || 5
45
+
46
+ @max_message_size = cfg[:max_message_size].to_i > 0 ? cfg[:max_message_size].to_i : 8
47
+
46
48
  @aws_url="#{@protocol}://#{@host}"
47
49
 
48
50
  @cache_queue_list = cfg[:cache_queue_list].nil? ? true : cfg[:cache_queue_list]
@@ -351,7 +353,11 @@ module ActiveMessaging
351
353
 
352
354
  def validate_message m
353
355
  raise "Message cannot be nil." if m.nil?
354
- raise "Message length, #{m.length}, must be between #{MESSAGE_SIZE.min} and #{MESSAGE_SIZE.max}." unless MESSAGE_SIZE.include?(m.length)
356
+ raise "Message length, #{m.length}, must be between #{message_size_range.min} and #{message_size_range.max}." unless message_size_range.include?(m.length)
357
+ end
358
+
359
+ def message_size_range
360
+ @_message_size_range ||= 1..(max_message_size * 1024)
355
361
  end
356
362
 
357
363
  def validate_timeout to
@@ -49,6 +49,29 @@ EOM
49
49
  @connection.disconnect unless @connection.nil?
50
50
  end
51
51
 
52
+ def test_message_size
53
+ assert_equal @connection.max_message_size, 8
54
+
55
+ @connection = ActiveMessaging::Adapters::AmazonSqs::Connection.new(:reliable=>false, :access_key_id=>'access_key_id', :secret_access_key=>'secret_access_key', :max_message_size => 10)
56
+
57
+ assert_nothing_raised do
58
+ @connection.send @d, @message
59
+ end
60
+
61
+ large_message = "m" * 1024 * 9
62
+ assert_nothing_raised do
63
+ @connection.send @d, large_message
64
+ end
65
+ large_message = nil
66
+
67
+ large_message = "m" * 1024 * 11
68
+ assert_raise(RuntimeError) do
69
+ @connection.send @d, large_message
70
+ end
71
+ large_message = nil
72
+
73
+ end
74
+
52
75
  def test_allow_underscore_and_dash
53
76
  assert_nothing_raised do
54
77
  @connection.subscribe 'name-name_dash'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemessaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Tirsen
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2014-06-05 00:00:00.000000000 Z
18
+ date: 2014-06-18 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activemessaging