Skip to main content

api.parse

api.parse(data [,messagetype] [,splitArrays])

Description

Parses data and returns it as a message(s) without publishing to 1Gateway. The arguments can either be (data), (data, messageType), (data, splitArrays) or (data, messageType, splitArrays).

Parameters

ParameterTypeExplanation
dataObjectThe data that gets sent in the message
messagetypeStringThe message_type of the message (located in headers/metadata)
splitArraysBooleanIf true, it will split an array into multiple message instead of one

Example

msg = api.parse("Hello world")
api.publish(msg, "HelloMessageType")