Skip to main content

Copy Messages to a Different Topic

The listing below copies messages from the Orders topic to the DuplicateOrders topic. Whenever a message is published to the Orders topic, this action will republish the message data to the DuplicateOrders topic.

The limitations for the amps-action-on-publish-message apply to this action. This action will only receive messages when the instance is active. This means that the action is not active during recovery, and will not publish duplicate messages when the topic the action is monitoring is recovered. This also means that adding this action to a configuration will not replay messages that were published to AMPS before the action was added.

warning

The amps-action-on-publish-message 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 interfer with other subscribers and depending on the queue configuration, may only receive one message during the lifetime of the instance.

<Actions>
<Action>
<On>
<Module>amps-action-on-publish-message</Module>
<Options>
<MessageType>nvfix</MessageType>
<Topic>Orders</Topic>
</Options>
</On>
<Do>
<Module>amps-action-do-publish-message</Module>
<Options>
<MessageType>nvfix</MessageType>
<Topic>DuplicateOrders</Topic>
<Data>{{AMPS_DATA}}</Data>
</Options>
</Do>
</Action>
</Actions>