NSQMQ API¶
The NSQMQ API provides a set of operations for interacting with NSQ (Next-Generation Message Queue), allowing users to manage topics, channels, publish messages, and consume data.
Why Integrate NSQ with EasyTask?¶
Integrating NSQ with EasyTask enables you to automate message queue management and event-driven workflows. This integration allows you to:
- Automate Topic and Channel Management: Programmatically create, pause, unpause, and delete topics and channels as part of your deployment and scaling workflows.
- Streamline Message Publishing and Consumption: Publish and consume messages in bulk with automated retry and error handling built into your EasyTask pipelines.
- Centralize NSQ Configuration: Store NSQ daemon addresses and ports securely in the EasyTask vault for consistent, environment-aware connections.
Required Values in Vault¶
{
"secret": {
"host": "xxxxxxxx (String Type)",
"nsqd_http_port": "xxxxxxxx (Int Type)",
"nsqd_tcp_port": "xxxxxxxx (Int Type)",
"nsqdlookupd_http_port": "xxxxxxxx (Int Type)"
}
}
Example Usage¶
curl -X POST http://localhost:8008/run-integration \
-H "Content-Type: application/json" \
-d '{
"is_credentials": {
"userid": "test",
"passwd": "test123"
},
"integration": "nsqmq",
"uuid": "ae0e8ba9-423a-410e-bba5-e1933ff868c5",
"init": {
"vault_path_key": "nsqmq/secret"
},
"action": [
{
"create_topic": {
"topic": "json_test_topic"
}
}
]
}'
Functions¶
create_topic¶
create_topic: This function creates a new topic in NSQ.
create_channel¶
create_channel: This function creates a new channel for a specific topic in NSQ.
empty_topic¶
empty_topic: This function empties all messages from a topic in NSQ.
empty_channel¶
empty_channel: This function empties all messages from a specific channel of a topic in NSQ.
pause_topic¶
pause_topic: This function pauses message flow for a topic in NSQ.
unpause_topic¶
unpause_topic: This function resumes message flow for a paused topic in NSQ.
pause_channel¶
pause_channel: This function pauses message flow for a specific channel of a topic in NSQ.
unpause_channel¶
unpause_channel: This function resumes message flow for a paused channel of a topic in NSQ.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| topic | str | Name of the topic | yes |
| channel | str | Name of the channel to unpause | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the channel was unpaused successfully |
get_all_topics¶
get_all_topics: This function retrieves a list of all topics in NSQ.
get_all_channels¶
get_all_channels: This function retrieves a list of all channels for a specific topic in NSQ.
publish¶
publish: This function publishes one or more messages to a topic in NSQ.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| topic | str | Name of the topic to publish to | yes |
| message | list | List of messages to publish | yes |
| mpub | bool | If true, publish multiple messages in a single request | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | True if the messages were published successfully |
consume¶
consume: This function consumes messages from a specific channel of a topic in NSQ.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| topic | str | Name of the topic to consume from | yes |
| channel | str | Name of the channel to consume from | yes |
| block | bool | If true, block until messages are available | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | list | List of consumed messages |
delete_channel¶
delete_channel: This function deletes a channel from a topic in NSQ.
delete_topic¶
delete_topic: This function deletes a topic from NSQ.
Frequently Asked Questions¶
How do I configure NSQ credentials in EasyTask?¶
Use the EasyTask vault system to securely store your NSQ connection details. Navigate to the integration configuration page and add your server details under a vault key like nsq/server1. Include the host, nsqd HTTP port, nsqd TCP port, and nsqlookupd HTTP port.
Can I use NSQ with both EasyTask Cloud and On-Premises?¶
Yes, NSQ works seamlessly with both EasyTask Cloud and On-Premises deployments. The configuration process is identical — just ensure the NSQ daemons are reachable from the integration server.
How do I troubleshoot NSQ connection issues?¶
Check the integration server logs in EasyTask for detailed error messages. Verify your host and port settings in the vault, ensure the NSQ daemons (nsqd and nsqlookupd) are accessible from the integration server, and test connectivity using the built-in connection test feature.