This closes #1277
This commit is contained in:
commit
db8c567baa
|
@ -416,7 +416,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
|
||||||
try {
|
try {
|
||||||
Message message = reference.getMessage();
|
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 (message.isLargeMessage() && supportLargeMessage) {
|
||||||
if (largeMessageDeliverer == null) {
|
if (largeMessageDeliverer == null) {
|
||||||
|
@ -434,7 +434,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
|
||||||
} finally {
|
} finally {
|
||||||
lockDelivery.readLock().unlock();
|
lockDelivery.readLock().unlock();
|
||||||
callback.afterDelivery();
|
callback.afterDelivery();
|
||||||
server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDeliver(reference) : null);
|
server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDeliver(this, reference) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,8 +280,33 @@ public interface ActiveMQServerPlugin {
|
||||||
/**
|
/**
|
||||||
* Before a message is delivered to a client consumer
|
* Before a message is delivered to a client consumer
|
||||||
*
|
*
|
||||||
* @param reference
|
* @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) {
|
default void beforeDeliver(MessageReference reference) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -290,7 +315,10 @@ public interface ActiveMQServerPlugin {
|
||||||
* After a message is delivered to a client consumer
|
* After a message is delivered to a client consumer
|
||||||
*
|
*
|
||||||
* @param reference
|
* @param reference
|
||||||
|
*
|
||||||
|
* @deprecated use {@link #afterDeliver(ServerConsumer, MessageReference)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
default void afterDeliver(MessageReference reference) {
|
default void afterDeliver(MessageReference reference) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,13 +239,13 @@ public class MethodCalledVerifier implements ActiveMQServerPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeDeliver(MessageReference reference) {
|
public void beforeDeliver(ServerConsumer consumer, MessageReference reference) {
|
||||||
Preconditions.checkNotNull(reference);
|
Preconditions.checkNotNull(reference);
|
||||||
methodCalled(BEFORE_DELIVER);
|
methodCalled(BEFORE_DELIVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterDeliver(MessageReference reference) {
|
public void afterDeliver(ServerConsumer consumer, MessageReference reference) {
|
||||||
Preconditions.checkNotNull(reference);
|
Preconditions.checkNotNull(reference);
|
||||||
methodCalled(AFTER_DELIVER);
|
methodCalled(AFTER_DELIVER);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue