Publish Message

The amps-action-do-publish-message module publishes a message into a specified topic.

Publishes from this action are treated as publishes from an AMPS client inside the AMPS engine. This means that:

  • There are no user credentials associated with the publish, so entitlements are not applied.

  • There is no special handling for the publish. The publish is recorded in the transaction log exactly as if it arrived from outside of the instance and is processed within the instance as if the publish had arrived from an external publisher.

This action is treated by the AMPS engine as a publish from an internal AMPS client. When an amps-action-do-publish-message runs in response to the amps-action-on-publish-message event or the amps-action-on-deliver-message event, use caution, the message published from this action could cause the event to trigger again.

This warning includes cases where the action publishes to a topic directly monitored by the action and cases where the action monitors a view and publishes to an underlying topic of the view. The warning also applies to configurations in which two or more actions "cross publish" to topics that are monitored by the other action. An example of the last case is an action that monitors TopicOne and publishes to TopicTwo, while another action monitors TopicTwo and publishes to TopicOne.

The result of a configuration like the ones described above is called a publish loop. AMPS does not support unterminated publish loops or loops that produce a large number of cycles before terminating.

To publish a message, this module requires a Topic, the MessageType to publish on and also the Data that the message will contain. In addition to that, this module also accepts optional parameters listed below:

ParameterDescription

Topic (required)

The topic of the message being published.

MessageType (required)

The message type for the topic.

There is no default for this parameter.

Data (required)

The data that the message will contain.

Delta

Whether to use a delta publish.

When this option is present, and the value is true, the action will use a delta publish.

UpdateOnly

Specifies whether a delta publish is allowed to insert a record, or only update a record.

When a delta publish is specified (that is, Delta is true ), and this option is set to true, AMPS will only accept the publish if there is a record present to be updated.

When no value is specified, this option is false.

This module does not add any variables to the AMPS context.

Last updated

Copyright 2013-2024 60East Technologies, Inc.