You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/06/18 23:57:42 UTC
[04/50] [abbrv] qpid-proton git commit: PROTON-781: Added the Acking
mixin to the Ruby reactive APIs.
PROTON-781: Added the Acking mixin to the Ruby reactive APIs.
The Acking mixin provides methods for handling the settling of messages
based on reactive callbacks.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1798ffa4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1798ffa4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1798ffa4
Branch: refs/heads/cjansen-cpp-client
Commit: 1798ffa4687c39e3bac1522ed16bcb9cfbf05863
Parents: ddd8c45
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Wed Feb 25 13:27:30 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400
----------------------------------------------------------------------
proton-c/bindings/ruby/lib/handler/acking.rb | 70 +++++++++++++++++++++++
proton-c/bindings/ruby/lib/qpid_proton.rb | 1 +
2 files changed, 71 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1798ffa4/proton-c/bindings/ruby/lib/handler/acking.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/handler/acking.rb b/proton-c/bindings/ruby/lib/handler/acking.rb
new file mode 100644
index 0000000..2c94cfe
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/handler/acking.rb
@@ -0,0 +1,70 @@
+#--
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#++
+
+module Qpid::Proton::Handler
+
+ # Mixing that provides methods for acknowledging a delivery.
+ #
+ module Acking
+
+ # Accept the receivered message.
+ #
+ # @param delivery [Qpid::Proton::Delivery] The delivery.
+ #
+ def accept(delivery)
+ self.settle(delivery, Qpid::Proton::Delivery::ACCEPTED)
+ end
+
+ # Rejects a received message that is considered invalid or unprocessable.
+ #
+ # @param delivery [Qpid::Proton::Delivery] The delivery.
+ #
+ def reject(delivery)
+ self.settle(delivery, Qpid::Proton::Delivery::REJECTED)
+ end
+
+ # Releases a received message, making it available at the source for any
+ # other interested receiver.
+ #
+ # @param delivery [Qpid::Proton::Delivery] The delivery
+ # @param delivered [Boolean] True if this was considered a delivery
+ # attempt.
+ #
+ def release(delivery, delivered = true)
+ if delivered
+ self.settle(delivery, Qpid::Proton::Delivery::MODIFIED)
+ else
+ self.settle(delivery, Qpid::Proton::Delivery::RELEASED)
+ end
+ end
+
+ # Settles the specified delivery. Updates the delivery state if a state
+ # is specified.
+ #
+ # @param delivery [Qpid::Proton::Delivery] The delivery.
+ # @param state [Fixnum] The delivery state.
+ #
+ def settle(delivery, state = nil)
+ delivery.update(state) unless state.nil?
+ delivery.settle
+ end
+
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1798ffa4/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index a4b3391..8db28f3 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -84,6 +84,7 @@ require "messenger/messenger"
# Handler classes
require "handler/c_adaptor"
require "handler/wrapped_handler"
+require "handler/acking"
module Qpid::Proton
# @private
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org