qpid_messaging 0.18.5 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +0 -39
- data/examples/client.rb +3 -1
- data/ext/cqpid/cqpid.cpp +40 -90
- data/ext/cqpid/extconf.rb +1 -2
- data/features/creating_a_receiver.feature +1 -1
- data/features/creating_a_sender.feature +1 -1
- data/features/step_definitions/address_steps.rb +11 -2
- data/lib/qpid_messaging/address.rb +13 -5
- data/lib/qpid_messaging/encoding.rb +16 -33
- data/lib/qpid_messaging/message.rb +16 -10
- data/lib/qpid_messaging/version.rb +2 -2
- data/spec/qpid_messaging/address_spec.rb +2 -2
- data/spec/qpid_messaging/message_spec.rb +1 -14
- data/spec/qpid_messaging/session_spec.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -33,7 +33,6 @@ require "rdoc/task"
|
|
33
33
|
require "rake/testtask"
|
34
34
|
|
35
35
|
require "cucumber/rake/task"
|
36
|
-
require "rspec/core/rake_task"
|
37
36
|
|
38
37
|
CLOBBER.include("pkg")
|
39
38
|
|
@@ -56,44 +55,6 @@ task :default => :test
|
|
56
55
|
desc "Runs all tests."
|
57
56
|
task :test => :"test:all"
|
58
57
|
|
59
|
-
#---------------
|
60
|
-
# Testing tasks.
|
61
|
-
#---------------
|
62
|
-
|
63
|
-
namespace :test do
|
64
|
-
|
65
|
-
desc "Run RSpec tests."
|
66
|
-
RSpec::Core::RakeTask.new do |t|
|
67
|
-
t.ruby_opts = ['-rtest/unit']
|
68
|
-
t.rcov = false
|
69
|
-
t.rcov_opts = [
|
70
|
-
'--exclude', 'lib\/qpid_messaging.rb,spec\/,lib\/ruby',
|
71
|
-
]
|
72
|
-
end
|
73
|
-
|
74
|
-
desc "Run all tests (default)."
|
75
|
-
task :all => [:spec, :features]
|
76
|
-
|
77
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
78
|
-
t.libs = ["lib", "ext/nonblockio"]
|
79
|
-
t.cucumber_opts = "--format progress"
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
#---------------------
|
85
|
-
# Documentation tasks.
|
86
|
-
#---------------------
|
87
|
-
|
88
|
-
Rake::RDocTask.new(:rdoc => "rdoc",
|
89
|
-
:clobber_rdoc => "rdoc:clean",
|
90
|
-
:rerdoc => "rdoc:force") do |rd|
|
91
|
-
rd.main = "README.rdoc"
|
92
|
-
rd.options << "--all"
|
93
|
-
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
94
|
-
rd.title = "Qpid Messaging Documentation"
|
95
|
-
end
|
96
|
-
|
97
58
|
#-----------------
|
98
59
|
# Package the gem.
|
99
60
|
#-----------------
|
data/examples/client.rb
CHANGED
@@ -29,7 +29,9 @@ if __FILE__ == $0
|
|
29
29
|
connection.open
|
30
30
|
session = connection.create_session
|
31
31
|
sender = session.create_sender "service_queue"
|
32
|
-
response_queue = Qpid::Messaging::Address.new("#response-queue
|
32
|
+
response_queue = Qpid::Messaging::Address.new("#response-queue", "",
|
33
|
+
:create => :always,
|
34
|
+
:delete => :always)
|
33
35
|
receiver = session.create_receiver response_queue
|
34
36
|
|
35
37
|
["Twas brillig, and the slithy toves",
|
data/ext/cqpid/cqpid.cpp
CHANGED
@@ -1859,12 +1859,6 @@ static VALUE mCqpid;
|
|
1859
1859
|
|
1860
1860
|
|
1861
1861
|
|
1862
|
-
struct mystr
|
1863
|
-
{
|
1864
|
-
size_t len;
|
1865
|
-
const char *ptr;
|
1866
|
-
};
|
1867
|
-
|
1868
1862
|
#include <qpid/messaging/exceptions.h>
|
1869
1863
|
#include <qpid/messaging/Address.h>
|
1870
1864
|
#include <qpid/messaging/Connection.h>
|
@@ -2000,9 +1994,6 @@ SWIG_From_std_string (const std::string& s)
|
|
2000
1994
|
return SWIG_FromCharPtrAndSize(s.data(), s.size());
|
2001
1995
|
}
|
2002
1996
|
|
2003
|
-
SWIGINTERN qpid::messaging::Duration qpid_messaging_Duration___mul__(qpid::messaging::Duration *self,uint64_t multiplier){
|
2004
|
-
return qpid::messaging::Duration(self->getMilliseconds() * multiplier);
|
2005
|
-
}
|
2006
1997
|
|
2007
1998
|
SWIGINTERNINLINE VALUE
|
2008
1999
|
SWIG_From_bool (bool value)
|
@@ -2135,6 +2126,13 @@ SWIG_AsVal_bool (VALUE obj, bool *val)
|
|
2135
2126
|
}
|
2136
2127
|
|
2137
2128
|
|
2129
|
+
SWIGINTERNINLINE VALUE
|
2130
|
+
SWIG_FromCharPtr(const char *cptr)
|
2131
|
+
{
|
2132
|
+
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
|
2138
2136
|
#define SWIG_From_long LONG2NUM
|
2139
2137
|
|
2140
2138
|
|
@@ -2151,12 +2149,6 @@ SWIG_From_size_t (size_t value)
|
|
2151
2149
|
return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value));
|
2152
2150
|
}
|
2153
2151
|
|
2154
|
-
SWIGINTERN mystr qpid_messaging_Message_getContentPtr(qpid::messaging::Message *self){
|
2155
|
-
mystr s;
|
2156
|
-
s.ptr = self->getContentPtr();
|
2157
|
-
s.len = self->getContentSize();
|
2158
|
-
return s;
|
2159
|
-
}
|
2160
2152
|
|
2161
2153
|
|
2162
2154
|
|
@@ -3169,45 +3161,6 @@ _wrap_Duration_MINUTE_get(VALUE self) {
|
|
3169
3161
|
}
|
3170
3162
|
|
3171
3163
|
|
3172
|
-
SWIGINTERN VALUE
|
3173
|
-
_wrap_Duration___mul__(int argc, VALUE *argv, VALUE self) {
|
3174
|
-
qpid::messaging::Duration *arg1 = (qpid::messaging::Duration *) 0 ;
|
3175
|
-
uint64_t arg2 ;
|
3176
|
-
void *argp1 = 0 ;
|
3177
|
-
int res1 = 0 ;
|
3178
|
-
SwigValueWrapper< qpid::messaging::Duration > result;
|
3179
|
-
VALUE vresult = Qnil;
|
3180
|
-
|
3181
|
-
if ((argc < 1) || (argc > 1)) {
|
3182
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
3183
|
-
}
|
3184
|
-
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_qpid__messaging__Duration, 0 | 0 );
|
3185
|
-
if (!SWIG_IsOK(res1)) {
|
3186
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "qpid::messaging::Duration *","__mul__", 1, self ));
|
3187
|
-
}
|
3188
|
-
arg1 = reinterpret_cast< qpid::messaging::Duration * >(argp1);
|
3189
|
-
{
|
3190
|
-
if (TYPE(argv[0]) == T_BIGNUM)
|
3191
|
-
arg2 = NUM2ULL(argv[0]);
|
3192
|
-
else
|
3193
|
-
arg2 = (uint64_t) FIX2ULONG(argv[0]);
|
3194
|
-
}
|
3195
|
-
{
|
3196
|
-
try {
|
3197
|
-
result = qpid_messaging_Duration___mul__(arg1,arg2);
|
3198
|
-
}
|
3199
|
-
catch (qpid::messaging::MessagingException& mex) {
|
3200
|
-
static VALUE merror = rb_define_class("MessagingError", rb_eStandardError);
|
3201
|
-
rb_raise(merror, mex.what());
|
3202
|
-
}
|
3203
|
-
}
|
3204
|
-
vresult = SWIG_NewPointerObj((new qpid::messaging::Duration(static_cast< const qpid::messaging::Duration& >(result))), SWIGTYPE_p_qpid__messaging__Duration, SWIG_POINTER_OWN | 0 );
|
3205
|
-
return vresult;
|
3206
|
-
fail:
|
3207
|
-
return Qnil;
|
3208
|
-
}
|
3209
|
-
|
3210
|
-
|
3211
3164
|
SWIGINTERN void
|
3212
3165
|
free_qpid_messaging_Duration(qpid::messaging::Duration *arg1) {
|
3213
3166
|
delete arg1;
|
@@ -4633,6 +4586,38 @@ fail:
|
|
4633
4586
|
}
|
4634
4587
|
|
4635
4588
|
|
4589
|
+
SWIGINTERN VALUE
|
4590
|
+
_wrap_Message_getContentPtr(int argc, VALUE *argv, VALUE self) {
|
4591
|
+
qpid::messaging::Message *arg1 = (qpid::messaging::Message *) 0 ;
|
4592
|
+
void *argp1 = 0 ;
|
4593
|
+
int res1 = 0 ;
|
4594
|
+
char *result = 0 ;
|
4595
|
+
VALUE vresult = Qnil;
|
4596
|
+
|
4597
|
+
if ((argc < 0) || (argc > 0)) {
|
4598
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
4599
|
+
}
|
4600
|
+
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_qpid__messaging__Message, 0 | 0 );
|
4601
|
+
if (!SWIG_IsOK(res1)) {
|
4602
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "qpid::messaging::Message const *","getContentPtr", 1, self ));
|
4603
|
+
}
|
4604
|
+
arg1 = reinterpret_cast< qpid::messaging::Message * >(argp1);
|
4605
|
+
{
|
4606
|
+
try {
|
4607
|
+
result = (char *)((qpid::messaging::Message const *)arg1)->getContentPtr();
|
4608
|
+
}
|
4609
|
+
catch (qpid::messaging::MessagingException& mex) {
|
4610
|
+
static VALUE merror = rb_define_class("MessagingError", rb_eStandardError);
|
4611
|
+
rb_raise(merror, mex.what());
|
4612
|
+
}
|
4613
|
+
}
|
4614
|
+
vresult = SWIG_FromCharPtr((const char *)result);
|
4615
|
+
return vresult;
|
4616
|
+
fail:
|
4617
|
+
return Qnil;
|
4618
|
+
}
|
4619
|
+
|
4620
|
+
|
4636
4621
|
SWIGINTERN VALUE
|
4637
4622
|
_wrap_Message_getContentSize(int argc, VALUE *argv, VALUE self) {
|
4638
4623
|
qpid::messaging::Message *arg1 = (qpid::messaging::Message *) 0 ;
|
@@ -4719,40 +4704,6 @@ fail:
|
|
4719
4704
|
}
|
4720
4705
|
|
4721
4706
|
|
4722
|
-
SWIGINTERN VALUE
|
4723
|
-
_wrap_Message_getContentPtr(int argc, VALUE *argv, VALUE self) {
|
4724
|
-
qpid::messaging::Message *arg1 = (qpid::messaging::Message *) 0 ;
|
4725
|
-
void *argp1 = 0 ;
|
4726
|
-
int res1 = 0 ;
|
4727
|
-
mystr result;
|
4728
|
-
VALUE vresult = Qnil;
|
4729
|
-
|
4730
|
-
if ((argc < 0) || (argc > 0)) {
|
4731
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
4732
|
-
}
|
4733
|
-
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_qpid__messaging__Message, 0 | 0 );
|
4734
|
-
if (!SWIG_IsOK(res1)) {
|
4735
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "qpid::messaging::Message *","getContentPtr", 1, self ));
|
4736
|
-
}
|
4737
|
-
arg1 = reinterpret_cast< qpid::messaging::Message * >(argp1);
|
4738
|
-
{
|
4739
|
-
try {
|
4740
|
-
result = qpid_messaging_Message_getContentPtr(arg1);
|
4741
|
-
}
|
4742
|
-
catch (qpid::messaging::MessagingException& mex) {
|
4743
|
-
static VALUE merror = rb_define_class("MessagingError", rb_eStandardError);
|
4744
|
-
rb_raise(merror, mex.what());
|
4745
|
-
}
|
4746
|
-
}
|
4747
|
-
{
|
4748
|
-
vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_FromCharPtrAndSize((&result)->ptr, (&result)->len));
|
4749
|
-
}
|
4750
|
-
return vresult;
|
4751
|
-
fail:
|
4752
|
-
return Qnil;
|
4753
|
-
}
|
4754
|
-
|
4755
|
-
|
4756
4707
|
static swig_class SwigClassEncodingException;
|
4757
4708
|
|
4758
4709
|
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
|
@@ -9812,7 +9763,6 @@ SWIGEXPORT void Init_cqpid(void) {
|
|
9812
9763
|
rb_define_singleton_method(SwigClassDuration.klass, "IMMEDIATE", VALUEFUNC(_wrap_Duration_IMMEDIATE_get), 0);
|
9813
9764
|
rb_define_singleton_method(SwigClassDuration.klass, "SECOND", VALUEFUNC(_wrap_Duration_SECOND_get), 0);
|
9814
9765
|
rb_define_singleton_method(SwigClassDuration.klass, "MINUTE", VALUEFUNC(_wrap_Duration_MINUTE_get), 0);
|
9815
|
-
rb_define_method(SwigClassDuration.klass, "*", VALUEFUNC(_wrap_Duration___mul__), -1);
|
9816
9766
|
SwigClassDuration.mark = 0;
|
9817
9767
|
SwigClassDuration.destroy = (void (*)(void *)) free_qpid_messaging_Duration;
|
9818
9768
|
SwigClassDuration.trackObjects = 0;
|
@@ -9846,9 +9796,9 @@ SWIGEXPORT void Init_cqpid(void) {
|
|
9846
9796
|
rb_define_method(SwigClassMessage.klass, "getProperties", VALUEFUNC(_wrap_Message_getProperties), -1);
|
9847
9797
|
rb_define_method(SwigClassMessage.klass, "setContent", VALUEFUNC(_wrap_Message_setContent), -1);
|
9848
9798
|
rb_define_method(SwigClassMessage.klass, "getContent", VALUEFUNC(_wrap_Message_getContent), -1);
|
9799
|
+
rb_define_method(SwigClassMessage.klass, "getContentPtr", VALUEFUNC(_wrap_Message_getContentPtr), -1);
|
9849
9800
|
rb_define_method(SwigClassMessage.klass, "getContentSize", VALUEFUNC(_wrap_Message_getContentSize), -1);
|
9850
9801
|
rb_define_method(SwigClassMessage.klass, "setProperty", VALUEFUNC(_wrap_Message_setProperty), -1);
|
9851
|
-
rb_define_method(SwigClassMessage.klass, "getContentPtr", VALUEFUNC(_wrap_Message_getContentPtr), -1);
|
9852
9802
|
SwigClassMessage.mark = 0;
|
9853
9803
|
SwigClassMessage.destroy = (void (*)(void *)) free_qpid_messaging_Message;
|
9854
9804
|
SwigClassMessage.trackObjects = 0;
|
data/ext/cqpid/extconf.rb
CHANGED
@@ -25,5 +25,5 @@ Feature: Creating a receiver
|
|
25
25
|
|
26
26
|
Scenario: Using an Address object
|
27
27
|
Given an open session
|
28
|
-
And an Address with the
|
28
|
+
And an Address with the name "create-receiver-test" and subject "foo" and option "create" set to "always" and "delete" set to "always"
|
29
29
|
Then creating a receiver with an Address succeeds
|
@@ -21,5 +21,5 @@ Feature: Creating a sender
|
|
21
21
|
|
22
22
|
Scenario: Using an Address object
|
23
23
|
Given an open session
|
24
|
-
And an Address with the
|
24
|
+
And an Address with the name "my-queue" and subject "my-subject" and option "create" set to "always"
|
25
25
|
Then creating a sender with an Address succeeds
|
@@ -17,6 +17,15 @@
|
|
17
17
|
# under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
Given /^an Address with the
|
21
|
-
|
20
|
+
Given /^an Address with the name "([^"]*)" and subject "([^"]*)" and option "([^"]*)" set to "([^"]*)"$/ do |name, subject, key, value|
|
21
|
+
options = Hash.new
|
22
|
+
options["#{key}"] = "#{value}"
|
23
|
+
@address = Qpid::Messaging::Address.new "#{name}", "#{subject}", options
|
24
|
+
end
|
25
|
+
|
26
|
+
Given /^an Address with the name "([^"]*)" and subject "([^"]*)" and option "([^"]*)" set to "([^"]*)" and "([^"]*)" set to "([^"]*)"$/ do |name, subject, key1, value1, key2, value2|
|
27
|
+
options = Hash.new
|
28
|
+
options["#{key1}"] = "#{value1}"
|
29
|
+
options["#{key2}"] = "#{value2}"
|
30
|
+
@address = Qpid::Messaging::Address.new "#{name}", "#{subject}", options
|
22
31
|
end
|
@@ -70,18 +70,26 @@ module Qpid
|
|
70
70
|
#
|
71
71
|
class Address
|
72
72
|
|
73
|
-
# Creates a new +Address+ object
|
73
|
+
# Creates a new +Address+ object.
|
74
74
|
#
|
75
75
|
# ==== Options
|
76
76
|
#
|
77
|
-
# *
|
77
|
+
# * name - The name for the +Address+.
|
78
|
+
# * subject - The subject for the +Address+
|
79
|
+
# * :create - See the class documentation.
|
80
|
+
# * :assert - See the class documentation.
|
81
|
+
# * :delete - See the class documentation.
|
82
|
+
# * :node - See the class documentation.
|
83
|
+
# * :link - See the class documentation.
|
84
|
+
# * :mode - See the class documentation.
|
78
85
|
#
|
79
86
|
# ==== Examples
|
80
87
|
#
|
81
|
-
# addr = Qpid::Messaging::Address.new "my-queue
|
88
|
+
# addr = Qpid::Messaging::Address.new "my-queue"
|
89
|
+
# addr = Qpid::Messaging::Address.new "my-queue", "testing", :create => :always
|
82
90
|
#
|
83
|
-
def initialize(
|
84
|
-
@address_impl = address_impl || Cqpid::Address.new(
|
91
|
+
def initialize(name, subject, options = {}, _type = "", address_impl = nil)
|
92
|
+
@address_impl = address_impl || Cqpid::Address.new(name, subject, convert_options(options), _type)
|
85
93
|
end
|
86
94
|
|
87
95
|
def address_impl # :nodoc:
|
@@ -23,52 +23,35 @@ module Qpid
|
|
23
23
|
|
24
24
|
# Encodes the supplied content into the given message.
|
25
25
|
def self.encode content, message, encoding = nil
|
26
|
-
|
26
|
+
prepared = content
|
27
|
+
case content
|
28
|
+
when Hash
|
29
|
+
prepared = {}
|
30
|
+
content.each_pair do |key,value|
|
31
|
+
prepared[key.to_s] = value.to_s
|
32
|
+
end
|
33
|
+
Cqpid::encode prepared, message.message_impl
|
34
|
+
when Array
|
35
|
+
prepared = []
|
36
|
+
content.each {|value| prepared << value.to_s}
|
37
|
+
Cqpid::encode prepared, message.message_impl
|
38
|
+
end
|
27
39
|
end
|
28
40
|
|
29
41
|
# Decodes and returns the message's content.
|
30
42
|
def self.decode(message, content_type = nil)
|
31
|
-
content_type = message.content_type
|
43
|
+
content_type = message.content_type unless content_type
|
32
44
|
|
33
45
|
case content_type
|
34
46
|
when "amqp/map"
|
35
|
-
|
47
|
+
Cqpid.decodeMap message.message_impl
|
36
48
|
when "amqp/list"
|
37
|
-
|
49
|
+
Cqpid.decodeList message.message_impl
|
38
50
|
end
|
39
51
|
|
40
52
|
message.content
|
41
53
|
end
|
42
54
|
|
43
|
-
# Takes as input any type and converts anything that's a symbol
|
44
|
-
# into a string.
|
45
|
-
def self.stringify(value)
|
46
|
-
# set the default value
|
47
|
-
result = value
|
48
|
-
|
49
|
-
case value
|
50
|
-
|
51
|
-
when Symbol
|
52
|
-
result = value.to_s
|
53
|
-
|
54
|
-
when Hash
|
55
|
-
result = {}
|
56
|
-
value.each_pair do |key, value|
|
57
|
-
result[stringify(key)] = stringify(value)
|
58
|
-
end
|
59
|
-
|
60
|
-
when Array
|
61
|
-
result = []
|
62
|
-
value.each do |element|
|
63
|
-
result << stringify(element)
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
return result
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
55
|
end
|
73
56
|
|
74
57
|
end
|
@@ -51,18 +51,18 @@ module Qpid
|
|
51
51
|
|
52
52
|
# Sets the address to which replies should be sent for the +Message+.
|
53
53
|
#
|
54
|
+
# *NOTE:* The address must be an instance of Address.
|
55
|
+
#
|
54
56
|
# ==== Options
|
55
57
|
#
|
56
|
-
# * address - an instance of +Address
|
58
|
+
# * address - an instance of +Address+
|
57
59
|
#
|
58
60
|
# ==== Examples
|
59
61
|
#
|
60
62
|
# msg.reply_to = Qpid:Messaging::Address.new "my-responses"
|
61
|
-
# msg.reply_to = "my-feed/responses"
|
62
63
|
#
|
63
64
|
def reply_to=(address)
|
64
|
-
|
65
|
-
|
65
|
+
raise ArgumentError, "Agument must be an Address" unless address.is_a? Qpid::Messaging::Address
|
66
66
|
@message_impl.setReplyTo address.address_impl
|
67
67
|
end
|
68
68
|
|
@@ -71,7 +71,7 @@ module Qpid
|
|
71
71
|
def reply_to
|
72
72
|
address_impl = @message_impl.getReplyTo
|
73
73
|
# only return an address if a reply to was specified
|
74
|
-
Qpid::Messaging::Address.new(nil, address_impl) if address_impl
|
74
|
+
Qpid::Messaging::Address.new(nil, nil, nil, nil, address_impl) if address_impl
|
75
75
|
end
|
76
76
|
|
77
77
|
# Sets the subject for the +Message+.
|
@@ -283,14 +283,14 @@ module Qpid
|
|
283
283
|
|
284
284
|
# Assigns a value to the named property.
|
285
285
|
#
|
286
|
+
# *NOTE:* Both the key or the value may be a symbol, but they will
|
287
|
+
# both be converted to a +String+ for ease of transport.
|
288
|
+
#
|
286
289
|
# ==== Options
|
287
290
|
#
|
288
291
|
# * name - the property name
|
289
292
|
# * value - the property value
|
290
|
-
def []=(key, value)
|
291
|
-
@message_impl.setProperty(key.to_s,
|
292
|
-
Qpid::Messaging.stringify(value))
|
293
|
-
end
|
293
|
+
def []=(key, value); @message_impl.setProperty(key.to_s, value.to_s); end
|
294
294
|
|
295
295
|
# Sets the content for the +Message+.
|
296
296
|
#
|
@@ -309,12 +309,18 @@ module Qpid
|
|
309
309
|
#
|
310
310
|
def content=(content)
|
311
311
|
content_type = nil
|
312
|
-
@content =
|
312
|
+
@content = content
|
313
313
|
case @content
|
314
314
|
when Hash
|
315
315
|
content_type = "amqp/map"
|
316
|
+
new_content = {}
|
317
|
+
content.each_pair{|key, value| new_content[key.to_s] = value.to_s}
|
318
|
+
@content = new_content
|
316
319
|
when Array
|
320
|
+
new_content = []
|
317
321
|
content_type = "amqp/list"
|
322
|
+
content.each {|element| new_content << element.to_s}
|
323
|
+
@content = new_content
|
318
324
|
end
|
319
325
|
if content_type.nil?
|
320
326
|
@message_impl.setContent @content
|
@@ -26,7 +26,7 @@ module Qpid
|
|
26
26
|
describe Address do
|
27
27
|
|
28
28
|
before(:each) do
|
29
|
-
@address = Qpid::Messaging::Address.new "my-name
|
29
|
+
@address = Qpid::Messaging::Address.new "my-name", "my-subject", :create => :always
|
30
30
|
end
|
31
31
|
|
32
32
|
it "stores the name, subject and options when created" do
|
@@ -72,7 +72,7 @@ module Qpid
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it "can return a string representation" do
|
75
|
-
address = Qpid::Messaging::Address.new "foo
|
75
|
+
address = Qpid::Messaging::Address.new "foo", "bar", :create => :always, :link => :durable
|
76
76
|
result = address.to_s
|
77
77
|
|
78
78
|
result.should =~ /foo\/bar/
|
@@ -36,7 +36,7 @@ module Qpid
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "can set the reply to address" do
|
39
|
-
address = Qpid::Messaging::Address.new "my-queue
|
39
|
+
address = Qpid::Messaging::Address.new "my-queue", ""
|
40
40
|
|
41
41
|
@message.reply_to = address
|
42
42
|
|
@@ -45,19 +45,6 @@ module Qpid
|
|
45
45
|
reply_to.name.should == address.name
|
46
46
|
end
|
47
47
|
|
48
|
-
it "can set the reply to from an address string" do
|
49
|
-
name = "my-queue"
|
50
|
-
subject = "responses"
|
51
|
-
address = "#{name}/#{subject}"
|
52
|
-
|
53
|
-
@message.reply_to = address
|
54
|
-
|
55
|
-
reply_to = @message.reply_to
|
56
|
-
|
57
|
-
reply_to.name.should == name
|
58
|
-
reply_to.subject.should == subject
|
59
|
-
end
|
60
|
-
|
61
48
|
it "should store the content when created" do
|
62
49
|
content = @message.content
|
63
50
|
|
@@ -46,7 +46,7 @@ module Qpid
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "creates a Sender from an Address" do
|
49
|
-
address = Qpid::Messaging::Address.new "my-
|
49
|
+
address = Qpid::Messaging::Address.new "my-queu", "", :create => :always
|
50
50
|
|
51
51
|
@session_impl.should_receive(:createSender).
|
52
52
|
with(address.address_impl).
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qpid_messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Qpid is an enterprise messaging framework.
|
15
15
|
email: dev@qpid.apache.org
|