On Message Published to AMPS

AMPS provides modules to run actions when a message is published to AMPS. The basic flow of AMPS messaging is to first receive a published message, find the subscriber(s) to which this message will be sent, then deliver that message to the subscriber(s).

The amps-action-on-publish-message runs actions as soon as a message is published to AMPS.

This action is treated by the AMPS engine as a subscription from an internal AMPS client.

When working with queues, use this action with the underlying topic of the queue rather than the queue topic itself. Because this action creates a subscription, using this action with the queue topic will cause the action to lease messages from the queue even though the action does not acknowledge messages. This means that, when used with the queue topic itself, the action will interfere with other subscribers and depending on the queue configuration, may only receive one message during the lifetime of the instance.

This module requires the Topic and the MessageType of the message that was published. In addition to that, this module also accepts the optional parameters listed below:

ParameterDescription

Topic (required)

The name of the topic to monitor for publishes.

This parameter supports regular expressions. There is no default for this parameter.

MessageType (required)

The message type of the topic to monitor for publishes. There is no default for this parameter.

MessageSource

The source to monitor for publishes. The source of the message defaults to all, which monitors both publishes directly to this AMPS instance and messages received via replication.

This parameter also accepts local for when the message source is published directly to this AMPS instance and replicated for messages received via replication.

Filter

Sets the filter to apply. Only messages that match this filter will cause the action to run.

Options

Sets the options to apply when listening for messages. This action supports any option that would be supported by the subscribe command when not using a bookmark.

This module adds the following variables to the AMPS context:

VariableDescription

AMPS_TOPIC

The topic of the message.

AMPS_DATA

The data the message contains.

AMPS_DATA_LENGTH

The length of the data that the message contains.

AMPS_BOOKMARK

The bookmark associated with this message.

AMPS_TIMESTAMP

The time at which the message was processed by AMPS.

AMPS_CLIENT_NAME

The name of the client from which the message was published.

Last updated

Copyright 2013-2024 60East Technologies, Inc.