Skip to content

Commit 8e17939

Browse files
committed
Add switch namespace method
1 parent 92fb6a4 commit 8e17939

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

openmessaging-api/src/main/java/io/openmessaging/manager/ResourceManager.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import io.openmessaging.exception.OMSRuntimeException;
2323
import io.openmessaging.exception.OMSSecurityException;
2424
import io.openmessaging.exception.OMSTimeOutException;
25-
import java.util.List;
25+
import java.util.Set;
2626

2727
/**
2828
* The {@code ResourceManager} is to provide a unified interface of resource management, allowing developers to manage
@@ -47,7 +47,6 @@ public interface ResourceManager {
4747
* that they have their own isolated instance of the global OMS resources.
4848
*
4949
* @param nsName the name of the new namespace.
50-
* @return create message result
5150
* @throws OMSSecurityException when have no authority to create namespace.
5251
* @throws OMSTimeOutException when the given timeout elapses before the create operation completes.
5352
* @throws OMSDestinationException when this given destination has been created in the server.
@@ -57,10 +56,9 @@ public interface ResourceManager {
5756
void createNamespace(String nsName);
5857

5958
/**
60-
* Deletes an existing namespace resource.
59+
* Deletes an existing namespace.
6160
*
6261
* @param nsName the namespace needs to be deleted.
63-
* @return delete namespace result
6462
* @throws OMSSecurityException when have no authority to delete this namespace.
6563
* @throws OMSTimeOutException when the given timeout elapses before the delete operation completes.
6664
* @throws OMSDestinationException when have no given destination in the server.
@@ -69,16 +67,28 @@ public interface ResourceManager {
6967
*/
7068
void deleteNamespace(String nsName);
7169

70+
/**
71+
* Switch to an existing namespace.
72+
*
73+
* @param targetNamespace the namespace needs to be switched.
74+
* @throws OMSSecurityException when have no authority to delete this namespace.
75+
* @throws OMSTimeOutException when the given timeout elapses before the delete operation completes.
76+
* @throws OMSDestinationException when have no given destination in the server.
77+
* @throws OMSRuntimeException when the {@code ResourceManager} fails to delete the namespace due to some internal
78+
* error.
79+
*/
80+
void switchNamespace(String targetNamespace);
81+
7282
/**
7383
* Gets the namespace list in the current {@code MessagingAccessPoint}.
7484
*
75-
* @return the list of all namespaces.
85+
* @return the set of all namespaces.
7686
* @throws OMSSecurityException when have no authority to delete this namespace.
7787
* @throws OMSTimeOutException when the given timeout elapses before the list operation completes.
7888
* @throws OMSRuntimeException when the {@code ResourceManager} fails to list the namespace due to some internal
7989
* error.
8090
*/
81-
List<String> listNamespaces();
91+
Set<String> listNamespaces();
8292

8393
/**
8494
* Creates a {@code Queue} resource in the configured namespace with some preset attributes.
@@ -100,7 +110,6 @@ public interface ResourceManager {
100110
* Deletes an existing queue resource.
101111
*
102112
* @param queueName the queue needs to be deleted.
103-
* @return delete queue result.
104113
* @throws OMSSecurityException when have no authority to delete this namespace.
105114
* @throws OMSTimeOutException when the given timeout elapses before the delete operation completes.
106115
* @throws OMSDestinationException when have no given destination in the server.
@@ -113,13 +122,13 @@ public interface ResourceManager {
113122
* Gets the queue list in the specific namespace.
114123
*
115124
* @param nsName the specific namespace.
116-
* @return all queues exists in the namespace.
125+
* @return the set of queues exists in current namespace.
117126
* @throws OMSSecurityException when have no authority to delete this namespace.
118127
* @throws OMSTimeOutException when the given timeout elapses before the list operation completes.
119128
* @throws OMSRuntimeException when the {@code ResourceManager} fails to list the namespace due to some internal
120129
* error.
121130
*/
122-
List<String> listQueues(String nsName);
131+
Set<String> listQueues(String nsName);
123132

124133
/**
125134
* In order to enable consumers to get the message in the specified mode, the filter rule follows the sql standard

0 commit comments

Comments
 (0)