You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2013/02/07 16:50:06 UTC
svn commit: r1443576 - in /qpid/trunk/qpid/cpp/bindings/qpid/ruby: ChangeLog
lib/qpid_messaging/connection.rb lib/qpid_messaging/errors.rb
lib/qpid_messaging/session.rb
Author: mcpierce
Date: Thu Feb 7 15:50:06 2013
New Revision: 1443576
URL: http://svn.apache.org/viewvc?rev=1443576&view=rev
Log:
QPID-4567: Dropped the errors.rb file and special exceptions.
The code will now raise MessagingException instead in error conditions.
Refactored the Session.sender, Session.receiver and Connection.session
methods to no longer raise those exceptions.
Removed:
qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/errors.rb
Modified:
qpid/trunk/qpid/cpp/bindings/qpid/ruby/ChangeLog
qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/connection.rb
qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/session.rb
Modified: qpid/trunk/qpid/cpp/bindings/qpid/ruby/ChangeLog
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/ChangeLog?rev=1443576&r1=1443575&r2=1443576&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/ChangeLog (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/ChangeLog Thu Feb 7 15:50:06 2013
@@ -1,3 +1,4 @@
Verison 0.22:
* Qpid::Messaging::Address can use an address string on creation.
* Qpid::Messaging::Message can use an address string for reply_to.
+ * Removed errors.rb and the KeyError and SessionNameException errors.
Modified: qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/connection.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/connection.rb?rev=1443576&r1=1443575&r2=1443576&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/connection.rb (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/connection.rb Thu Feb 7 15:50:06 2013
@@ -119,23 +119,26 @@ module Qpid
end
end
- # Returns a session for the specified session name.
+ # Returns a Session with the given name.
#
- # ==== Examples
+ # If no such Session exists then a MessagingException is raised.
+ # == Options
#
+ # * +name+ - the session name
+ #
+ # == Examples
+ #
+ # # retrieve a session named 'mysession' from the current connection
+ # name = "my-session"
# begin
- # session = conn.session "mysession"
- # rescue SessionNameException => error
- # puts "No such session."
+ # session = conn.session name
+ # rescue MessagingException => error
+ # puts "No such session: #{name}."
# end
#
def session name
- begin
- session_impl = @connection_impl.getSession name
- Qpid::Messaging::Session.new self, session_impl if session_impl
- rescue
- raise Qpid::Messaging::SessionNameException.new "No such session: #{name}"
- end
+ session_impl = @connection_impl.getSession name
+ Qpid::Messaging::Session.new self, session_impl if session_impl
end
# Returns the username used to authenticate with the connection.
Modified: qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/session.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/session.rb?rev=1443576&r1=1443575&r2=1443576&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/session.rb (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/lib/qpid_messaging/session.rb Thu Feb 7 15:50:06 2013
@@ -27,8 +27,6 @@ module Qpid
def initialize(connection, session) # :nodoc:
@connection = connection
@session_impl = session
- @senders = Hash.new
- @receivers = Hash.new
end
def session_impl # :nodoc:
@@ -63,15 +61,12 @@ module Qpid
sender_impl = @session_impl.createSender(_address)
sender_name = sender_impl.getName
- @senders[sender_name] = Qpid::Messaging::Sender.new(self, sender_impl)
-
- @senders[sender_name]
+ Qpid::Messaging::Sender.new(self, sender_impl)
end
# Retrieves the +Sender+ with the specified name.
#
- # The +Sender+ must have been previously created using
- # the +create_sender+ method.
+ # Raises an exception when no such Sender exists.
#
# ==== Arguments
#
@@ -82,9 +77,7 @@ module Qpid
# sender = session.sender "my-queue"
#
def sender(name)
- raise Qpid::Messaging::KeyError, "No such sender: #{name}" unless @senders.has_key? name
-
- @senders[name]
+ Qpid::Messaging::Sender.new self, @session_impl.getSender(name)
end
# Creates a new endpoint for receiving messages.
@@ -111,17 +104,11 @@ module Qpid
receiver_impl = @session_impl.createReceiver(address)
end
- receiver_name = receiver_impl.getName
-
- @receivers[receiver_name] = Qpid::Messaging::Receiver.new self, receiver_impl
-
- @receivers[receiver_name]
+ Qpid::Messaging::Receiver.new self, receiver_impl
end
- # Retrieves the +Receiver+ with the specified name.
- #
- # The +Receiver+ must have been previously created using
- # the +create_receiver+ method.
+ # Retrieves the +Receiver+ with the specified name, or nil if no such
+ # Receiver exists.
#
# ==== Arguments
#
@@ -132,9 +119,7 @@ module Qpid
# receiver = session.receiver "my-queue"
#
def receiver(name)
- raise Qpid::Messaging::KeyError, "No such receiver: #{name}" unless @receivers.has_key? name
-
- @receivers[name]
+ Qpid::Messaging::Receiver.new self, @session_impl.getReceiver(name)
end
# Closes the +Session+ and all associated +Sender+ and +Receiver+ instances.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org