qpid_messaging 0.18.3 → 0.18.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.
- data/Rakefile +39 -0
- data/examples/client.rb +1 -3
- data/ext/cqpid/cqpid.cpp +90 -40
- data/features/creating_a_receiver.feature +1 -1
- data/features/creating_a_sender.feature +1 -1
- data/features/step_definitions/address_steps.rb +2 -11
- data/lib/qpid_messaging/address.rb +5 -13
- data/lib/qpid_messaging/message.rb +5 -5
- data/lib/qpid_messaging/version.rb +1 -1
- data/spec/qpid_messaging/address_spec.rb +2 -2
- data/spec/qpid_messaging/message_spec.rb +14 -1
- data/spec/qpid_messaging/session_spec.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -33,6 +33,7 @@ require "rdoc/task"
|
|
33
33
|
require "rake/testtask"
|
34
34
|
|
35
35
|
require "cucumber/rake/task"
|
36
|
+
require "rspec/core/rake_task"
|
36
37
|
|
37
38
|
CLOBBER.include("pkg")
|
38
39
|
|
@@ -55,6 +56,44 @@ task :default => :test
|
|
55
56
|
desc "Runs all tests."
|
56
57
|
task :test => :"test:all"
|
57
58
|
|
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
|
+
|
58
97
|
#-----------------
|
59
98
|
# Package the gem.
|
60
99
|
#-----------------
|
data/examples/client.rb
CHANGED
@@ -29,9 +29,7 @@ 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"
|
33
|
-
:create => :always,
|
34
|
-
:delete => :always)
|
32
|
+
response_queue = Qpid::Messaging::Address.new("#response-queue;{create:always}")
|
35
33
|
receiver = session.create_receiver response_queue
|
36
34
|
|
37
35
|
["Twas brillig, and the slithy toves",
|
data/ext/cqpid/cqpid.cpp
CHANGED
@@ -1859,6 +1859,12 @@ static VALUE mCqpid;
|
|
1859
1859
|
|
1860
1860
|
|
1861
1861
|
|
1862
|
+
struct mystr
|
1863
|
+
{
|
1864
|
+
size_t len;
|
1865
|
+
const char *ptr;
|
1866
|
+
};
|
1867
|
+
|
1862
1868
|
#include <qpid/messaging/exceptions.h>
|
1863
1869
|
#include <qpid/messaging/Address.h>
|
1864
1870
|
#include <qpid/messaging/Connection.h>
|
@@ -1994,6 +2000,9 @@ SWIG_From_std_string (const std::string& s)
|
|
1994
2000
|
return SWIG_FromCharPtrAndSize(s.data(), s.size());
|
1995
2001
|
}
|
1996
2002
|
|
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
|
+
}
|
1997
2006
|
|
1998
2007
|
SWIGINTERNINLINE VALUE
|
1999
2008
|
SWIG_From_bool (bool value)
|
@@ -2126,13 +2135,6 @@ SWIG_AsVal_bool (VALUE obj, bool *val)
|
|
2126
2135
|
}
|
2127
2136
|
|
2128
2137
|
|
2129
|
-
SWIGINTERNINLINE VALUE
|
2130
|
-
SWIG_FromCharPtr(const char *cptr)
|
2131
|
-
{
|
2132
|
-
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
|
2133
|
-
}
|
2134
|
-
|
2135
|
-
|
2136
2138
|
#define SWIG_From_long LONG2NUM
|
2137
2139
|
|
2138
2140
|
|
@@ -2149,6 +2151,12 @@ SWIG_From_size_t (size_t value)
|
|
2149
2151
|
return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value));
|
2150
2152
|
}
|
2151
2153
|
|
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
|
+
}
|
2152
2160
|
|
2153
2161
|
|
2154
2162
|
|
@@ -3161,6 +3169,45 @@ _wrap_Duration_MINUTE_get(VALUE self) {
|
|
3161
3169
|
}
|
3162
3170
|
|
3163
3171
|
|
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
|
+
|
3164
3211
|
SWIGINTERN void
|
3165
3212
|
free_qpid_messaging_Duration(qpid::messaging::Duration *arg1) {
|
3166
3213
|
delete arg1;
|
@@ -4586,38 +4633,6 @@ fail:
|
|
4586
4633
|
}
|
4587
4634
|
|
4588
4635
|
|
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
|
-
|
4621
4636
|
SWIGINTERN VALUE
|
4622
4637
|
_wrap_Message_getContentSize(int argc, VALUE *argv, VALUE self) {
|
4623
4638
|
qpid::messaging::Message *arg1 = (qpid::messaging::Message *) 0 ;
|
@@ -4704,6 +4719,40 @@ fail:
|
|
4704
4719
|
}
|
4705
4720
|
|
4706
4721
|
|
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
|
+
|
4707
4756
|
static swig_class SwigClassEncodingException;
|
4708
4757
|
|
4709
4758
|
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
|
@@ -9763,6 +9812,7 @@ SWIGEXPORT void Init_cqpid(void) {
|
|
9763
9812
|
rb_define_singleton_method(SwigClassDuration.klass, "IMMEDIATE", VALUEFUNC(_wrap_Duration_IMMEDIATE_get), 0);
|
9764
9813
|
rb_define_singleton_method(SwigClassDuration.klass, "SECOND", VALUEFUNC(_wrap_Duration_SECOND_get), 0);
|
9765
9814
|
rb_define_singleton_method(SwigClassDuration.klass, "MINUTE", VALUEFUNC(_wrap_Duration_MINUTE_get), 0);
|
9815
|
+
rb_define_method(SwigClassDuration.klass, "*", VALUEFUNC(_wrap_Duration___mul__), -1);
|
9766
9816
|
SwigClassDuration.mark = 0;
|
9767
9817
|
SwigClassDuration.destroy = (void (*)(void *)) free_qpid_messaging_Duration;
|
9768
9818
|
SwigClassDuration.trackObjects = 0;
|
@@ -9796,9 +9846,9 @@ SWIGEXPORT void Init_cqpid(void) {
|
|
9796
9846
|
rb_define_method(SwigClassMessage.klass, "getProperties", VALUEFUNC(_wrap_Message_getProperties), -1);
|
9797
9847
|
rb_define_method(SwigClassMessage.klass, "setContent", VALUEFUNC(_wrap_Message_setContent), -1);
|
9798
9848
|
rb_define_method(SwigClassMessage.klass, "getContent", VALUEFUNC(_wrap_Message_getContent), -1);
|
9799
|
-
rb_define_method(SwigClassMessage.klass, "getContentPtr", VALUEFUNC(_wrap_Message_getContentPtr), -1);
|
9800
9849
|
rb_define_method(SwigClassMessage.klass, "getContentSize", VALUEFUNC(_wrap_Message_getContentSize), -1);
|
9801
9850
|
rb_define_method(SwigClassMessage.klass, "setProperty", VALUEFUNC(_wrap_Message_setProperty), -1);
|
9851
|
+
rb_define_method(SwigClassMessage.klass, "getContentPtr", VALUEFUNC(_wrap_Message_getContentPtr), -1);
|
9802
9852
|
SwigClassMessage.mark = 0;
|
9803
9853
|
SwigClassMessage.destroy = (void (*)(void *)) free_qpid_messaging_Message;
|
9804
9854
|
SwigClassMessage.trackObjects = 0;
|
@@ -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 string "create-receiver-test;{create: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 string "my-queue/my-subject;{create:always}"
|
25
25
|
Then creating a sender with an Address succeeds
|
@@ -17,15 +17,6 @@
|
|
17
17
|
# under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
Given /^an Address with the
|
21
|
-
|
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
|
20
|
+
Given /^an Address with the string "(.*?)"$/ do |address|
|
21
|
+
@address = Qpid::Messaging::Address.new "#{address}"
|
31
22
|
end
|
@@ -70,26 +70,18 @@ module Qpid
|
|
70
70
|
#
|
71
71
|
class Address
|
72
72
|
|
73
|
-
# Creates a new +Address+ object.
|
73
|
+
# Creates a new +Address+ object from an address string.
|
74
74
|
#
|
75
75
|
# ==== Options
|
76
76
|
#
|
77
|
-
# *
|
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.
|
77
|
+
# * address - the address string
|
85
78
|
#
|
86
79
|
# ==== Examples
|
87
80
|
#
|
88
|
-
# addr = Qpid::Messaging::Address.new "my-queue"
|
89
|
-
# addr = Qpid::Messaging::Address.new "my-queue", "testing", :create => :always
|
81
|
+
# addr = Qpid::Messaging::Address.new "my-queue;{create:always}"
|
90
82
|
#
|
91
|
-
def initialize(
|
92
|
-
@address_impl = address_impl || Cqpid::Address.new(
|
83
|
+
def initialize(address, address_impl = nil)
|
84
|
+
@address_impl = address_impl || Cqpid::Address.new(address)
|
93
85
|
end
|
94
86
|
|
95
87
|
def address_impl # :nodoc:
|
@@ -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
|
-
#
|
56
54
|
# ==== Options
|
57
55
|
#
|
58
|
-
# * address - an instance of +Address
|
56
|
+
# * address - an instance of +Address+, or an address string
|
59
57
|
#
|
60
58
|
# ==== Examples
|
61
59
|
#
|
62
60
|
# msg.reply_to = Qpid:Messaging::Address.new "my-responses"
|
61
|
+
# msg.reply_to = "my-feed/responses"
|
63
62
|
#
|
64
63
|
def reply_to=(address)
|
65
|
-
|
64
|
+
address = Qpid::Messaging::Address.new "#{address}" if !address.is_a? Qpid::Messaging::Address
|
65
|
+
|
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,
|
74
|
+
Qpid::Messaging::Address.new(nil, address_impl) if address_impl
|
75
75
|
end
|
76
76
|
|
77
77
|
# Sets the subject for the +Message+.
|
@@ -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;{create:always}"
|
40
40
|
|
41
41
|
@message.reply_to = address
|
42
42
|
|
@@ -45,6 +45,19 @@ 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
|
+
|
48
61
|
it "should store the content when created" do
|
49
62
|
content = @message.content
|
50
63
|
|
@@ -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-queue;{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.18.
|
4
|
+
version: 0.18.4
|
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-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Qpid is an enterprise messaging framework.
|
15
15
|
email: dev@qpid.apache.org
|