Skip to content

Commit

Permalink
Allow managing namespaces, update HTTP API, test
Browse files Browse the repository at this point in the history
  • Loading branch information
weyoss committed Feb 7, 2022
1 parent d6e3376 commit b0c265c
Show file tree
Hide file tree
Showing 163 changed files with 1,311 additions and 676 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
* Allow to delete a message queue alongside with its related data.
* Make sure to release queue lock before returning.
* Improve QueueManager API method names, update docs.
* Update QueueManager API reference (add deleteMessageQueue() method).
* Update QueueManager API reference (add deleteQueue() method).
* Fix QueueManager broken method references in the Web UI.
* Rename purgeScheduledMessages() to purgeScheduledQueue().
* Test deleting queues, wait for a heartbeat before returning during startup.
Expand Down
59 changes: 51 additions & 8 deletions docs/api/queue-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ QueueManager.getSingletonInstance(config, (err, queueManager) => {
## Table of Content

1. [QueueManager.getSingletonInstance()](#queuemanagergetsingletoninstance)
2. [QueueManager.prototype.getMessageQueues()](#queuemanagerprototypegetmessagequeues)
3. [QueueManager.prototype.getQueueMetrics()](#queuemanagerprototypegetqueuemetrics)
4. [QueueManager.prototype.deleteMessageQueue()](#queuemanagerprototypedeletemessagequeue)
5. [QueueManager.prototype.quit()](#queuemanagerprototypequit)
2. [QueueManager.prototype.getQueues()](#queuemanagerprototypegetqueues)
3. [QueueManager.prototype.getNamespaces()](#queuemanagerprototypegetnamespaces)
4. [QueueManager.prototype.getNamespaceQueues()]()
5. [QueueManager.prototype.getQueueMetrics()](#queuemanagerprototypegetqueuemetrics)
6. [QueueManager.prototype.deleteQueue()](#queuemanagerprototypedeletequeue)
7. [QueueManager.prototype.deleteNamespace()](#queuemanagerprototypedeletenamespace)
8. [QueueManager.prototype.quit()](#queuemanagerprototypequit)

## Public Static Methods

Expand All @@ -35,10 +38,10 @@ getSingletonInstance(cb)

## Public Methods

### QueueManager.prototype.getMessageQueues()
### QueueManager.prototype.getQueues()

```javascript
getMessageQueues(cb);
getQueues(cb);
```

**Parameters**
Expand All @@ -48,6 +51,32 @@ getMessageQueues(cb);
- `messageQueues[*].ns` *(string).* Queue namespace.
- `messageQueues[*].name` *(string).* Queue name.

### QueueManager.prototype.getNamespaces()

```javascript
getQueues(cb);
```

**Parameters**
- `cb(err, namespaces)` *(Function): Required.* Callback function.
- `err` *(Error | null | undefined).* Error object.
- `namespaces` *(Array).* Namespaces.

### QueueManager.prototype.getNamespaceQueues()

```javascript
getNamespaceQueues(ns, cb);
```

**Parameters**

- `ns` *(string): Required.* Namespace.
- `cb(err, messageQueues)` *(Function): Required.* Callback function.
- `err` *(Error | null | undefined).* Error object.
- `messageQueues` *(Array).*
- `messageQueues[*].ns` *(string).* Queue namespace.
- `messageQueues[*].name` *(string).* Queue name.

### QueueManager.prototype.getQueueMetrics()

```javascript
Expand All @@ -67,10 +96,10 @@ getQueueMetrics(queue, cb);
- `queueMetrics.pending` *(number).* Pending messages count.
- `queueMetrics.pendingWithPriority` *(number).* Pending messages with priority count.

### QueueManager.prototype.deleteMessageQueue()
### QueueManager.prototype.deleteQueue()

```javascript
deleteMessageQueue(queue, cb);
deleteQueue(queue, cb);
```

**Parameters**
Expand All @@ -83,6 +112,20 @@ deleteMessageQueue(queue, cb);

Before deleting a message queue, make sure that the given queue is not being in use. Otherwise, an error will be returned.

### QueueManager.prototype.deleteNamespace()

```javascript
deleteNamespace(ns, cb);
```

**Parameters**

- `ns` *(string): Required.* Namespace.
- `cb(err)` *(Function): Required.* Callback function.
- `err` *(Error | null | undefined).* Error object.

Before deleting a namespace, make sure that all queues from the given namespace are not being in use. Otherwise, an error will be returned.

### QueueManager.prototype.quit()

```javascript
Expand Down
Loading

0 comments on commit b0c265c

Please sign in to comment.