Quantcast

[1/2] activemq-artemis git commit: ARTEMIS-1172 - Update beforeDeliver and afterDeliver method arguments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[1/2] activemq-artemis git commit: ARTEMIS-1172 - Update beforeDeliver and afterDeliver method arguments

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 7b7a78249 -> db8c567ba


ARTEMIS-1172 - Update beforeDeliver and afterDeliver method arguments

Adding ServerConsumer as an argument to both the beforeDeliver and
afterDeliver methods inside ActiveMQServerPlugin and deprecated the old
methods


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/48a2dd1f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/48a2dd1f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/48a2dd1f

Branch: refs/heads/master
Commit: 48a2dd1f45abafa933461672ab76db71dae734a1
Parents: 7b7a782
Author: Christopher L. Shannon (cshannon) <[hidden email]>
Authored: Wed May 17 13:45:22 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Wed May 17 20:38:47 2017 -0400

----------------------------------------------------------------------
 .../core/server/impl/ServerConsumerImpl.java    |  4 +--
 .../server/plugin/ActiveMQServerPlugin.java     | 28 ++++++++++++++++++++
 .../plugin/MethodCalledVerifier.java            |  4 +--
 3 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/48a2dd1f/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
index efddf73..b18bb26 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
@@ -416,7 +416,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
       try {
          Message message = reference.getMessage();
 
-         server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeDeliver(reference) : null);
+         server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeDeliver(this, reference) : null);
 
          if (message.isLargeMessage() && supportLargeMessage) {
             if (largeMessageDeliverer == null) {
@@ -434,7 +434,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
       } finally {
          lockDelivery.readLock().unlock();
          callback.afterDelivery();
-         server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDeliver(reference) : null);
+         server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDeliver(this, reference) : null);
       }
 
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/48a2dd1f/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java
index 95296f0..dd304ae 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerPlugin.java
@@ -280,8 +280,33 @@ public interface ActiveMQServerPlugin {
    /**
     * Before a message is delivered to a client consumer
     *
+    * @param consumer the consumer the message will be delivered to
+    * @param reference message reference
+    */
+   default void beforeDeliver(ServerConsumer consumer, MessageReference reference) {
+      //by default call the old method for backwards compatibility
+      this.beforeDeliver(reference);
+   }
+
+   /**
+    * After a message is delivered to a client consumer
+    *
+    * @param consumer the consumer the message was delivered to
+    * @param reference message reference
+    */
+   default void afterDeliver(ServerConsumer consumer, MessageReference reference) {
+      //by default call the old method for backwards compatibility
+      this.afterDeliver(reference);
+   }
+
+   /**
+    * Before a message is delivered to a client consumer
+    *
     * @param reference
+    *
+    * @deprecated use {@link #beforeDeliver(ServerConsumer, MessageReference)}
     */
+   @Deprecated
    default void beforeDeliver(MessageReference reference) {
 
    }
@@ -290,7 +315,10 @@ public interface ActiveMQServerPlugin {
     * After a message is delivered to a client consumer
     *
     * @param reference
+    *
+    * @deprecated use {@link #afterDeliver(ServerConsumer, MessageReference)}
     */
+   @Deprecated
    default void afterDeliver(MessageReference reference) {
 
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/48a2dd1f/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java
index d7627b5..71b01f1 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MethodCalledVerifier.java
@@ -239,13 +239,13 @@ public class MethodCalledVerifier implements ActiveMQServerPlugin {
    }
 
    @Override
-   public void beforeDeliver(MessageReference reference) {
+   public void beforeDeliver(ServerConsumer consumer, MessageReference reference) {
       Preconditions.checkNotNull(reference);
       methodCalled(BEFORE_DELIVER);
    }
 
    @Override
-   public void afterDeliver(MessageReference reference) {
+   public void afterDeliver(ServerConsumer consumer, MessageReference reference) {
       Preconditions.checkNotNull(reference);
       methodCalled(AFTER_DELIVER);
    }

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[2/2] activemq-artemis git commit: This closes #1277

clebertsuconic-2
This closes #1277


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/db8c567b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/db8c567b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/db8c567b

Branch: refs/heads/master
Commit: db8c567baa825ca6c27e6916d337a3015634c975
Parents: 7b7a782 48a2dd1
Author: Clebert Suconic <[hidden email]>
Authored: Wed May 17 20:38:48 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Wed May 17 20:38:48 2017 -0400

----------------------------------------------------------------------
 .../core/server/impl/ServerConsumerImpl.java    |  4 +--
 .../server/plugin/ActiveMQServerPlugin.java     | 28 ++++++++++++++++++++
 .../plugin/MethodCalledVerifier.java            |  4 +--
 3 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


Loading...