Reads stored messages without a consumer: by sequence, by newest on a subject,…
Reads stored messages without a consumer: by sequence, by newest on a subject, or walking a subject forward from a sequence.
GET /v1/mq/stream/{name}/message
| Address | https://api.hanzo.ai/v1/mq/stream/{name}/message |
| Method | GET |
| Operation | get_mq_stream_by_name_message |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Reads stored messages without a consumer: by sequence, by newest on a subject, or walking a subject forward from a sequence.
Request
5 fields.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | Name is the stream name, from the path. |
seq | query | integer | — | Seq reads the message at this sequence (with next_by_subject: the walk's start). |
last_by_subject | query | string | — | LastBySubject reads the newest message on this org-relative subject. |
next_by_subject | query | string | — | NextBySubject walks forward from seq collecting messages on this org-relative subject (wildcards supported). |
limit | query | integer | — | Limit caps a next_by_subject walk (1–1000, default 100). |
Response
| Status | Body | Meaning |
|---|---|---|
200 | readOut | ok |
200 body — 9 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
messages | body | Delivery[] | — | Messages is what was read, stream-ordered. |
messages[].data | body | string | — | Data is the payload, base64-encoded. |
messages[].headers | body | object | — | Headers are the message headers, when any were published. |
messages[].headers.* | body | string[] | — | |
messages[].num_delivered | body | integer | — | Delivered is how many times a consumer has been handed this message (pulls only). |
messages[].num_pending | body | integer | — | Remaining is how many messages follow this one for the consumer (pulls only). |
messages[].sequence | body | integer | — | Sequence is the message's stream sequence. |
messages[].subject | body | string | — | Subject is the org-relative subject the message was stored under. |
messages[].timestamp | body | string (date-time) | — | Timestamp is when the broker stored the message. |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, MqApi } from 'hanzoai';
const api = new MqApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getMqStreamByNameMessage({ name: 'name' });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import MqApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = MqApi(client).get_mq_stream_by_name_message(name='name')cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.MqAPI.GetMqStreamByNameMessage(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, mq_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = mq_api::get_mq_stream_by_name_message(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.MqApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new MqApi(client).getMqStreamByNameMessage();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/mq/stream/<name>/message \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches mq through the mq tool, which names its 15 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "get_mq_health"
}
}
}'How is this guide?