Transport Filters

AMPS provides the ability for incoming commands to be modified, or filtered.

When one or more transport filters are specified, AMPS provides each incoming command to those filters as soon as the header for the message is parsed. Each filter can modify the message data or a subset of the headers, and can choose to have AMPS stop processing the command (or can request that AMPS disconnect the connection that submitted the command).

The filters for a Transport, if any, are defined in the configuration for the transport. When more than one filter is specified, AMPS runs each filter in the order in which they appear in the configuration file.

Transport filters are implemented as extension modules. To create an extension module, contact AMPS support for the server SDK.

AMPS loads the following transport filters by default:

ModuleDescription

amps-topic-translator

Translates topic names on incoming commands.

This module requires one or more of the following options: Topic

Specifies the translation to use. This option takes the following format: original : translated

The original parameter can be a literal topic name or a PCRE regex. Any topic on any command that matches that parameter will be converted to the translated topic.

For example, to convert the topic legacy to the topic new, you would specify the following option:

 <Options> <Topic>legacy:new</Topic> </Options> 

To translate any topic beginning with /orders/northamerica to NAorders, you would specify the following option:

 <Options> <Topic>^/orders/northamerica:NAorders</Topic> </Options> 

amps-conflated-topic-translator

Translates an incoming subscribe, sow_and_subscribe, delta_subscribe, or sow_and_delta_subscribe command for a specific topic name as follows:

  • Translates the topic name on the command to a different topic name.

  • Adds a conflation interval to the command, if there is no conflation interval specified on the incoming command.

This module can be useful for removing a conflated topic that is infrequently-used, or for which subscribers only monitor a small number of messages out of the overall topic.

This module requires one or more of the following options: Topic

Specifies the translation to use. This option takes the following format: original : translated : interval

The interval specifies the conflation interval to apply to the translated commands if one is not provided.

For example, to convert all subscriptions to the topic orders-C to the topic orders, and guarantee that each translated subscription has a conflation specified, with a 500 millisecond default for conflation, you would use the following options:

 <Options> <Topic>orders-C:orders:500ms</Topic> </Options> 

To convert all subscriptions to the topics slowUpdates and verySlowUpdates to the topic updates and guarantee that each translated subscription has a conflation specified, with a 2 second default for conflation, you would use the following options:

 <Options> <Topic>slowUpdates:updates:2s</Topic> <Topic>verySlowUpdates:updates:2s</Topic> </Options> 

Last updated

Copyright 2013-2024 60East Technologies, Inc.