MQOperationResponse
Package: @opra/common
MQOperationResponse describes the outgoing message produced by an MQOperation. It declares the response channel, payload type, optional key type, and any response-specific headers.
Inheritance
DocumentElement
└── MQOperationResponse
Properties
| Property | Type | Description |
|---|---|---|
channel | string | undefined | Response channel or topic. undefined means the response goes to the same channel as the request. |
description | string | undefined | Human-readable description of the response. |
type | DataType | Data type of the response payload. Defaults to 'any' when not explicitly declared. |
keyType | DataType | undefined | Optional data type for the response message key. |
headers | MQHeader[] | Headers declared on the response. |
designType | Type | undefined | TypeScript constructor from design:type metadata. |
keyDesignType | Type | undefined | TypeScript constructor for the key type from metadata. |
Methods
findHeader(paramName)
Searches for a header by name on this response. Returns undefined if not found.
const header = response.findHeader('x-reply-to');
findHeader(paramName: string): MQHeader | undefined
toJSON(options?)
Returns a plain OpraSchema.MQOperationResponse object for schema export.
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.MQOperationResponse
Accessing a response descriptor
MQOperationResponse is always accessed through its parent operation — it is not retrieved directly from the document.
import { MQApi } from '@opra/common';
const document = await ApiDocumentFactory.createDocument({ ... });
if (document.api instanceof MQApi) {
const op = document.api.findOperation('CustomerQueue', 'processOrder');
if (op) {
const { response } = op;
console.log(response.channel); // reply channel, or undefined
console.log(response.type.name); // payload type name
console.log(response.headers); // MQHeader[]
}
}
→ MQOperation · MQHeader