Message Queue Payload - JS/TS
The logic payload type when a task is invoked by a Message Queue (MQ) trigger.
Class Reference
Type
{ messageQueue: MessagePayload }
(one of the Payload type)
Sub Class Reference
MessagePayload
Importable from
@fstnetwork/loc-logic-sdk
Property | Type | Description |
---|---|---|
clientIdentityContext | IdentityContextFor_Uuid | MQ client ID and name |
subscriber | Subscriber | MQ subscriber |
data | number[] | MQ data (empty array if none) |
IdentityContextFor_Uuid
Refer to:
IdentityContextFor_Uuid
Subscriber
MQ Type | Subscriber Type | Reference |
---|---|---|
Apache Kafka | { kafka: KafkaSubscriber } | KafkaSubscriber |
KafkaSubscriber
Property | Type | Description |
---|---|---|
brokers | string[] | Broker names in the Kafka cluster |
groupId | string | MQ group ID |
topic | string | MQ topic |
partition | number | MQ partition |
offset | number | MQ offset |
Examples
- JavaScript
- TypeScript
const payload = await ctx.payload();
const data = payload.messageQueue?.data;
Import class(s)
import {
// ...
MessagePayload,
} from "@fstnetwork/loc-logic-sdk";
const payload: { messageQueue: MessagePayload } = await ctx.payload();
const data = payload.messageQueue?.data;
See the example of Payload for using type guard on payload types.
See the example of HTTP Payload for parsing
data
to a JSON object.