IPWorks IoT 2020 JavaScript Edition

Questions / Feedback?

MessageIn Event

Fires when the class receives a message.

Syntax

amqp.on('MessageIn', listener: (e: {readonly sessionName: string, readonly sessionIndex: number, readonly linkName: string, readonly linkIndex: number, readonly messageId: string, state: number}) => void )

Remarks

This event fires whenever the class receives a message. The message itself is automatically stored in the ReceivedMessage* properties.

Specifying a Delivery Outcome

The State parameter can be set to one of the following values to specify what delivery outcome the class should report to the sender (the default is Accepted (0)):
  • 0: Accepted - The message has been processed successfully.
  • 1: Rejected - The message failed to process successfully. Includes an error describing why.
  • 2: Released - The message has not been (and will not be) processed.
  • 3: Modified - Same as "Released", but with additional metadata for the sender.

When State is set to Rejected (1), the class will include error metadata when it informs the sender of the outcome. Set the RejectErrorCondition and RejectErrorDescription configuration settings before the event handler finishes to specify this error information.

When State is set to Modified (3), the class can include additional metadata when it informs the sender of the outcome. Set zero or more of the ModifiedDeliveryFailed, ModifiedMessageAnnotations, and ModifiedUndeliverableHere configuration settings before the event handler finishes to specify this additional metadata.

Other Parameters

SessionName is the name of the session the message was transmitted on.

SessionIndex is the index of the session in the Session* properties.

LinkName is the name of the link the message was transmitted on.

LinkIndex is the index of the link in the Link* properties.

MessageId is the Id of the message; it may be empty if a message Id was not set.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 JavaScript Edition - Version 20.0 [Build 8265]