qpid_messaging 0.20.2 → 0.22.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.
Files changed (45) hide show
  1. data/ChangeLog +4 -0
  2. data/LICENSE +0 -4
  3. data/README.rdoc +15 -20
  4. data/TODO +10 -5
  5. data/ext/cqpid/cqpid.cpp +156 -40
  6. data/ext/cqpid/extconf.rb +10 -2
  7. data/lib/qpid_messaging.rb +56 -3
  8. data/lib/qpid_messaging/address.rb +51 -28
  9. data/lib/qpid_messaging/connection.rb +75 -46
  10. data/lib/qpid_messaging/duration.rb +49 -14
  11. data/lib/qpid_messaging/encoding.rb +5 -5
  12. data/lib/qpid_messaging/message.rb +61 -68
  13. data/lib/qpid_messaging/receiver.rb +62 -67
  14. data/lib/qpid_messaging/sender.rb +39 -56
  15. data/lib/qpid_messaging/session.rb +78 -81
  16. metadata +51 -61
  17. data/Rakefile +0 -137
  18. data/features/closing_a_connection.feature +0 -13
  19. data/features/closing_a_session.feature +0 -13
  20. data/features/connecting_to_a_broker.feature +0 -13
  21. data/features/creating_a_receiver.feature +0 -29
  22. data/features/creating_a_sender.feature +0 -25
  23. data/features/creating_a_session.feature +0 -12
  24. data/features/getting_the_connections_authenticated_username.feature +0 -8
  25. data/features/receiving_a_message.feature +0 -30
  26. data/features/sending_a_message.feature +0 -21
  27. data/features/session_returns_its_connection.feature +0 -12
  28. data/features/sessions_have_names.feature +0 -8
  29. data/features/step_definitions/address_steps.rb +0 -22
  30. data/features/step_definitions/connection_steps.rb +0 -93
  31. data/features/step_definitions/receiver_steps.rb +0 -69
  32. data/features/step_definitions/sender_steps.rb +0 -34
  33. data/features/step_definitions/session_steps.rb +0 -99
  34. data/features/support/env.rb +0 -22
  35. data/lib/qpid_messaging/errors.rb +0 -33
  36. data/lib/qpid_messaging/version.rb +0 -31
  37. data/spec/qpid_messaging/address_spec.rb +0 -87
  38. data/spec/qpid_messaging/connection_spec.rb +0 -191
  39. data/spec/qpid_messaging/duration_spec.rb +0 -56
  40. data/spec/qpid_messaging/encoding_spec.rb +0 -63
  41. data/spec/qpid_messaging/message_spec.rb +0 -305
  42. data/spec/qpid_messaging/receiver_spec.rb +0 -170
  43. data/spec/qpid_messaging/sender_spec.rb +0 -135
  44. data/spec/qpid_messaging/session_spec.rb +0 -353
  45. data/spec/spec_helper.rb +0 -20
@@ -0,0 +1,4 @@
1
+ Verison 0.22:
2
+ * Qpid::Messaging::Address can use an address string on creation.
3
+ * Qpid::Messaging::Message can use an address string for reply_to.
4
+ * Removed errors.rb and the KeyError and SessionNameException errors.
data/LICENSE CHANGED
@@ -1,7 +1,3 @@
1
- =========================================================================
2
- == Apache License ==
3
- =========================================================================
4
-
5
1
  Apache License
6
2
  Version 2.0, January 2004
7
3
  http://www.apache.org/licenses/
@@ -1,46 +1,41 @@
1
1
  = Qpid - Ruby language bindings for the Qpid messaging framework.
2
2
 
3
- Qpid is an cross-platform enterprise messaging system based on the open-source
3
+ Qpid is a cross-platform enterprise messaging system based on the open-source
4
4
  AMQP protocol.
5
5
 
6
- Version :: 0.20.0
7
-
8
6
  = Links
9
7
 
10
8
  Documents :: http://qpid.apache.org/
11
9
 
12
- = Installation
10
+ = Building The Gemfile
11
+
12
+ == Prerequisites
13
13
 
14
- You can install Qpid with the following command.
14
+ You need to have the Qpid client libraries installed along with the related
15
+ development files (headers, etc). To install them, please see:
15
16
 
16
- $ gem install qpid_messaging
17
+ http://cwiki.apache.org/qpid/developer-pages.html
17
18
 
18
- == Building The Native Code
19
+ == Gemfile Creation
19
20
 
20
- The Qpid gem requires that you have available the Qpid libraries and
21
- development header files. To install them, please see:
21
+ Simply type:
22
22
 
23
- http://cwiki.apache.org/qpid/developer-pages.html
23
+ $ gem build qpid_messaging.gemspec
24
24
 
25
- If you are building the gem within the Qpid development environment
26
- itself, you can specify the location of the Qpid headers and
27
- libraries with:
25
+ This will produce a gemfile name qpid_messaging-${VERSION}.gem.
28
26
 
29
- $ ruby extconfig.rb --with-qpid-lib=[path to libqpidclient.so, etc.]
30
- $ make
27
+ == Installation
31
28
 
32
- == Examples
29
+ You can install Qpid with the following command:
33
30
 
34
- Take a look at the integration tests for examples on how to leverage
35
- the messaging capabilities of Qpid in your Ruby applications.
31
+ $ gem install qpid_messaging-${VERSION}.gem
36
32
 
37
33
  == License
38
34
 
39
35
  Licensed to the Apache Software Foundation (ASF) under one or more
40
36
  contributor licensing agreements.
41
37
 
42
- Author:: Darryl L. Pierce (mailto:dpierce@redhat.com)
43
- Copyright:: Copyright (c) 2011, Red Hat, Inc.
38
+ Author:: Apache Qpid Project
44
39
  Homepage:: http://qpid.apache.org
45
40
  License:: Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html
46
41
 
data/TODO CHANGED
@@ -1,7 +1,12 @@
1
- TODO Items
2
- -----------------------------------------------------------------------------
1
+ Qpid Ruby bindigns TODO List
2
+ ==============================================================================
3
3
 
4
- Version 0.11.0:
5
- * Deliver the Ruby bindings as a gem.
6
- * Rework the blocking tasks to not bring the main thread to a halt.
4
+ Beyond this simple laundry list, you can find the list of bugs and
5
+ enhancements to be fixed by going to the Apache Qpid JIRA instance:
7
6
 
7
+ http://issues.apache.org/jira/browse/QPID
8
+
9
+
10
+ Fixes & Improvements
11
+ ==============================================================================
12
+ * Fix the threading issues with blocking I/O calls (Receiver get/fetch).
@@ -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
@@ -6273,6 +6322,38 @@ fail:
6273
6322
  }
6274
6323
 
6275
6324
 
6325
+ SWIGINTERN VALUE
6326
+ _wrap_Receiver_getAddress(int argc, VALUE *argv, VALUE self) {
6327
+ qpid::messaging::Receiver *arg1 = (qpid::messaging::Receiver *) 0 ;
6328
+ void *argp1 = 0 ;
6329
+ int res1 = 0 ;
6330
+ qpid::messaging::Address result;
6331
+ VALUE vresult = Qnil;
6332
+
6333
+ if ((argc < 0) || (argc > 0)) {
6334
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6335
+ }
6336
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_qpid__messaging__Receiver, 0 | 0 );
6337
+ if (!SWIG_IsOK(res1)) {
6338
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "qpid::messaging::Receiver const *","getAddress", 1, self ));
6339
+ }
6340
+ arg1 = reinterpret_cast< qpid::messaging::Receiver * >(argp1);
6341
+ {
6342
+ try {
6343
+ result = ((qpid::messaging::Receiver const *)arg1)->getAddress();
6344
+ }
6345
+ catch (qpid::messaging::MessagingException& mex) {
6346
+ static VALUE merror = rb_define_class("MessagingError", rb_eStandardError);
6347
+ rb_raise(merror, mex.what());
6348
+ }
6349
+ }
6350
+ vresult = SWIG_NewPointerObj((new qpid::messaging::Address(static_cast< const qpid::messaging::Address& >(result))), SWIGTYPE_p_qpid__messaging__Address, SWIG_POINTER_OWN | 0 );
6351
+ return vresult;
6352
+ fail:
6353
+ return Qnil;
6354
+ }
6355
+
6356
+
6276
6357
  static swig_class SwigClassSender;
6277
6358
 
6278
6359
  SWIGINTERN VALUE
@@ -6801,6 +6882,38 @@ fail:
6801
6882
  }
6802
6883
 
6803
6884
 
6885
+ SWIGINTERN VALUE
6886
+ _wrap_Sender_getAddress(int argc, VALUE *argv, VALUE self) {
6887
+ qpid::messaging::Sender *arg1 = (qpid::messaging::Sender *) 0 ;
6888
+ void *argp1 = 0 ;
6889
+ int res1 = 0 ;
6890
+ qpid::messaging::Address result;
6891
+ VALUE vresult = Qnil;
6892
+
6893
+ if ((argc < 0) || (argc > 0)) {
6894
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6895
+ }
6896
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_qpid__messaging__Sender, 0 | 0 );
6897
+ if (!SWIG_IsOK(res1)) {
6898
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "qpid::messaging::Sender const *","getAddress", 1, self ));
6899
+ }
6900
+ arg1 = reinterpret_cast< qpid::messaging::Sender * >(argp1);
6901
+ {
6902
+ try {
6903
+ result = ((qpid::messaging::Sender const *)arg1)->getAddress();
6904
+ }
6905
+ catch (qpid::messaging::MessagingException& mex) {
6906
+ static VALUE merror = rb_define_class("MessagingError", rb_eStandardError);
6907
+ rb_raise(merror, mex.what());
6908
+ }
6909
+ }
6910
+ vresult = SWIG_NewPointerObj((new qpid::messaging::Address(static_cast< const qpid::messaging::Address& >(result))), SWIGTYPE_p_qpid__messaging__Address, SWIG_POINTER_OWN | 0 );
6911
+ return vresult;
6912
+ fail:
6913
+ return Qnil;
6914
+ }
6915
+
6916
+
6804
6917
  static swig_class SwigClassSession;
6805
6918
 
6806
6919
  SWIGINTERN VALUE
@@ -9763,6 +9876,7 @@ SWIGEXPORT void Init_cqpid(void) {
9763
9876
  rb_define_singleton_method(SwigClassDuration.klass, "IMMEDIATE", VALUEFUNC(_wrap_Duration_IMMEDIATE_get), 0);
9764
9877
  rb_define_singleton_method(SwigClassDuration.klass, "SECOND", VALUEFUNC(_wrap_Duration_SECOND_get), 0);
9765
9878
  rb_define_singleton_method(SwigClassDuration.klass, "MINUTE", VALUEFUNC(_wrap_Duration_MINUTE_get), 0);
9879
+ rb_define_method(SwigClassDuration.klass, "*", VALUEFUNC(_wrap_Duration___mul__), -1);
9766
9880
  SwigClassDuration.mark = 0;
9767
9881
  SwigClassDuration.destroy = (void (*)(void *)) free_qpid_messaging_Duration;
9768
9882
  SwigClassDuration.trackObjects = 0;
@@ -9796,9 +9910,9 @@ SWIGEXPORT void Init_cqpid(void) {
9796
9910
  rb_define_method(SwigClassMessage.klass, "getProperties", VALUEFUNC(_wrap_Message_getProperties), -1);
9797
9911
  rb_define_method(SwigClassMessage.klass, "setContent", VALUEFUNC(_wrap_Message_setContent), -1);
9798
9912
  rb_define_method(SwigClassMessage.klass, "getContent", VALUEFUNC(_wrap_Message_getContent), -1);
9799
- rb_define_method(SwigClassMessage.klass, "getContentPtr", VALUEFUNC(_wrap_Message_getContentPtr), -1);
9800
9913
  rb_define_method(SwigClassMessage.klass, "getContentSize", VALUEFUNC(_wrap_Message_getContentSize), -1);
9801
9914
  rb_define_method(SwigClassMessage.klass, "setProperty", VALUEFUNC(_wrap_Message_setProperty), -1);
9915
+ rb_define_method(SwigClassMessage.klass, "getContentPtr", VALUEFUNC(_wrap_Message_getContentPtr), -1);
9802
9916
  SwigClassMessage.mark = 0;
9803
9917
  SwigClassMessage.destroy = (void (*)(void *)) free_qpid_messaging_Message;
9804
9918
  SwigClassMessage.trackObjects = 0;
@@ -9827,6 +9941,7 @@ SWIGEXPORT void Init_cqpid(void) {
9827
9941
  rb_define_method(SwigClassReceiver.klass, "isClosed", VALUEFUNC(_wrap_Receiver_isClosed), -1);
9828
9942
  rb_define_method(SwigClassReceiver.klass, "getName", VALUEFUNC(_wrap_Receiver_getName), -1);
9829
9943
  rb_define_method(SwigClassReceiver.klass, "getSession", VALUEFUNC(_wrap_Receiver_getSession), -1);
9944
+ rb_define_method(SwigClassReceiver.klass, "getAddress", VALUEFUNC(_wrap_Receiver_getAddress), -1);
9830
9945
  SwigClassReceiver.mark = 0;
9831
9946
  SwigClassReceiver.destroy = (void (*)(void *)) free_qpid_messaging_Receiver;
9832
9947
  SwigClassReceiver.trackObjects = 0;
@@ -9843,6 +9958,7 @@ SWIGEXPORT void Init_cqpid(void) {
9843
9958
  rb_define_method(SwigClassSender.klass, "getAvailable", VALUEFUNC(_wrap_Sender_getAvailable), -1);
9844
9959
  rb_define_method(SwigClassSender.klass, "getName", VALUEFUNC(_wrap_Sender_getName), -1);
9845
9960
  rb_define_method(SwigClassSender.klass, "getSession", VALUEFUNC(_wrap_Sender_getSession), -1);
9961
+ rb_define_method(SwigClassSender.klass, "getAddress", VALUEFUNC(_wrap_Sender_getAddress), -1);
9846
9962
  SwigClassSender.mark = 0;
9847
9963
  SwigClassSender.destroy = (void (*)(void *)) free_qpid_messaging_Sender;
9848
9964
  SwigClassSender.trackObjects = 0;
@@ -25,8 +25,16 @@
25
25
 
26
26
  require 'mkmf'
27
27
 
28
+ (rver, rrev, rmin) = RUBY_VERSION.split('.')
29
+
30
+ old_ruby = (rver == "1" && rrev < "9") # pre-1.9
31
+
28
32
  # Setup the build environment.
29
- $CFLAGS = "-fPIC -fno-inline -x c++ -lstdc++"
33
+ if old_ruby
34
+ $CFLAGS = "-fPIC -fno-inline -x c++ -lstdc++"
35
+ else
36
+ $CFLAGS = "-fPIC -fno-inline"
37
+ end
30
38
 
31
39
  REQUIRED_LIBRARIES = [
32
40
  'stdc++',
@@ -68,7 +76,7 @@ have_library('stdc++')
68
76
 
69
77
  REQUIRED_LIBRARIES.each {|library| require_library library}
70
78
 
71
- REQUIRED_HEADERS.each {|header| require_header header}
79
+ REQUIRED_HEADERS.each {|header| require_header header} if old_ruby
72
80
 
73
81
  create_makefile('cqpid')
74
82
 
@@ -1,4 +1,4 @@
1
- #
1
+ #--
2
2
  # Licensed to the Apache Software Foundation (ASF) under one
3
3
  # or more contributor license agreements. See the NOTICE file
4
4
  # distributed with this work for additional information
@@ -15,9 +15,9 @@
15
15
  # KIND, either express or implied. See the License for the
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
- #
18
+ #++
19
+
19
20
  require 'cqpid'
20
- require 'qpid_messaging/errors'
21
21
  require 'qpid_messaging/duration'
22
22
  require 'qpid_messaging/address'
23
23
  require 'qpid_messaging/encoding'
@@ -27,3 +27,56 @@ require 'qpid_messaging/receiver'
27
27
  require 'qpid_messaging/session'
28
28
  require 'qpid_messaging/connection'
29
29
 
30
+ module Qpid
31
+
32
+ # The Qpid Messaging framework is an enterprise messaging framework
33
+ # based on the open-source AMQP protocol.
34
+ #
35
+ # ==== Example Application
36
+ #
37
+ # Here is a simple example application. It creates a link to a broker located
38
+ # on a system named *broker.myqpiddomain.com*. It then creates a new messaging
39
+ # queue named "qpid-examples" and publishes a message to it. It then consumes
40
+ # that same message and closes the connection.
41
+ #
42
+ # require 'rubygems'
43
+ # gem 'qpid_messaging'
44
+ # require 'qpid_messaging'
45
+ #
46
+ # # create a connection, open it and then create a session named "session1"
47
+ # conn = Qpid::Messaging::Connection.new :name => "broker.myqpiddomain.com"
48
+ # conn.open
49
+ # session = conn.create_session "session1"
50
+ #
51
+ # # create a sender and a receiver
52
+ # # the sender marks the queue as one that is deleted when trhe sender disconnects
53
+ # send = session.create_sender "qpid-examples;{create:always,delete:always}"
54
+ # recv = session.create_receiver "qpid-examples"
55
+ #
56
+ # # create an outgoing message and send it
57
+ # outgoing = Qpid::Messaging::Message.new :content => "The time is #{Time.new}"
58
+ # sender.send outgoing
59
+ #
60
+ # # set the receiver's capacity to 10 and then check out many messages are pending
61
+ # recv.capacity = 10
62
+ # puts "There are #{recv.available} messages waiting." # should report 1 message
63
+ #
64
+ # # get the nextwaiting message, which should be in the local queue now,
65
+ # # and output the contents
66
+ # incoming = recv.get Qpid::Messaging::Duration::IMMEDIATE
67
+ # puts "Received the following message: #{incoming.content}"
68
+ # # the output should be the text that was sent earlier
69
+ #
70
+ # # acknowledge the message, letting the sender know the message was received
71
+ # puts "The sender currently has #{send.unsettled} message(s) pending."
72
+ # # should report 1 unsettled message
73
+ # session.acknowledge incoming # acknowledge the received message
74
+ # puts "Now sender currently has #{send.unsettled} message(s) pending."
75
+ # # should report 0 unsettled messages
76
+ #
77
+ # # close the connection
78
+ # conn.close
79
+ #
80
+ module Messaging; end
81
+
82
+ end