Implement the Pause method for a Topic via Management APIs
Overview
An Artemis Queue can be paused but there is nothing for a Topic. The goal of this feature is to be able to pause a Topic by pausing all its consumers . New subscriptions being registered while the topic is in pause will be paused also. This is implemented in Apache Artemis and we need to expose this feature in the WildFly management API.
Issue Metadata
Issue
Related Issues
Dev Contacts
QE Contacts
Testing By
[X] Engineering
[ ] QE
Affected Projects or Components
-
Apache Artemis
-
WildFly
Other Interested Projects
Requirements
Allow the user to pause or resume a topic thus stopping all the subscribers from receiving new messages from a paused topic.
The user should be able to check the current status of a topic.
A paused topic won’t propagate messages to subscribers but it doesn’t refuse messages sent to the topic.
Using the persist
parameter we can store the state of the topic to keep it paused on restart of the broker.
Implementation Plan
Adding a pause
and a resume
methods on the resource /subsystem=messaging-activemq/server=default/jms-topic.
The pause
method has a boolean persist
parameter which is optionnal and default to false.
We need also to add a runtime only boolean `paused`attribute to /subsystem=messaging-activemq/server=default/jms-topic to indicate the status of the Topic.
CLI to execute the commands:
/subsystem=messaging-activemq/server=default/jms-topic=topic:pause() { "outcome" => "success", "result" => undefined } /subsystem=messaging-activemq/server=default/jms-topic=topic:read-attribute(name=paused) { "outcome" => "success", "result" => true } /subsystem=messaging-activemq/server=default/jms-topic=topic:resume() { "outcome" => "success", "result" => undefined } /subsystem=messaging-activemq/server=default/jms-topic=topic:read-attribute(name=paused) { "outcome" => "success", "result" => false }
Test Plan
Add a new method testPauseAndResume
in org.jboss.as.test.integration.messaging.mgmt.JMSTopicManagementTestCase
to test the pausing of a Topic:
-
create a topic with a consumer and a producer
-
pause the topic
-
send a message
-
check that the topic is paused and the message is not consumed.
-
resume the topic
-
check that the topic is running and the message is consumed.
Add 2 tests in org.jboss.as.test.manualmode.messaging.RuntimeJMSTopicManagementTestCase
:
-
testPauseAndResume
:-
start the server
-
create a topic with a consumer and a producer
-
pause the topic with persist = false
-
send a message
-
check that the topic is paused and the message is not consumed.
-
restart the server
-
create a consumer
-
check that the topic is running and the message is consumed.
-
-
testPauseAndResumePersisted
:-
start the server
-
create a topic with a consumer and a producer
-
pause the topic with persist = true
-
send a message
-
check that the topic is paused and the message is not consumed.
-
restart the server
-
create a consumer
-
check that the topic is paused and the message is not consumed.
-
resume the topic
-
check that the topic is running and the message is consumed.
-
The feature is already tested in Apache Artemis test suite AddressPauseTest.java
Community Documentation
-
Covered by operation description in management model.