Configuring Conflated Topics in a SOW
This section lists the parameters for defining a ConflatedTopic
within the SOW section of an AMPS configuration file (also called topic replicas in previous releases of AMPS).
For compatibility with previous AMPS versions, AMPS allows you to use ReplicaDefinition
as a synonym for ConflatedTopic
.
Described below are the configuration items for defining a ConflatedTopic
. Expand each item for more details.
Name
(required)
String used to define the name of the conflated topic. While AMPS doesn't enforce naming conventions, it can be convenient to name the conflated topic based on the underlying topic name.
For example, if the underlying topic is orders
, it can be convenient to name the conflated topic orders-C
.
If no Name
is provided, AMPS accepts Topic
as a synonym for Name
to provide compatibility with versions of AMPS previous to 5.0.
UnderlyingTopic
(required)
String used to define the SOW topic which provides updates to the conflated topic. This must exactly match the name of a SOW topic.
When the underlying topic is a regular expression topic, this must match the Name
of the topic rather than the Pattern
of the topic. In this case, the conflated topic will conflate all of the topics in the underlying regular expression topic into individual topics, with the names of the individual topics set using the TopicFormat
element.
MessageType
(required)
The message format of the underlying topic.
This MessageType
must be the MessageType
of the provided UnderlyingTopic
.
Interval
The frequency at which AMPS updates the data in the conflated topic.
Default: 5s
Minimum: 100ms
Filter
Content filter that is applied to the underlying topic.
Only messages that match the content filter are stored in the conflated topic.
HashIndex
AMPS provides the ability to do fast lookup for SOW records based on specific fields.
When one or more HashIndex
elements are provided, AMPS creates a hash index for the fields specified in the element. These indexes are created on startup, and are kept up to date as records are added, removed, and updated.
The HashIndex
element contains a Key
element for each field in the hash index.
AMPS uses a hash index when a query uses exact matching for all of the fields in the index. AMPS does not use hash indexes for range queries or regular expressions.
AMPS automatically creates a hash index for the set of fields specified in the set of Key
fields for the UnderlyingTopic
, if that topic provides Key
fields.
If the underlying topic of a ConflatedTopic
is a set of logical topics defined with the Pattern
element, an additional configuration parameter is required to specify the topic name that AMPS will use for each conflated topic. Expand the item for more details.
TopicFormat
(required if UnderlyingTopic
uses a Pattern
)
String used to format the name of the conflated topics when the underlying topic uses a Pattern
to create a group of logical topics within a single physical topic.
When the underlying topic is a regular expression topic, AMPS will create a conflated topic for each topic within the regular expression topic. This element specifies how AMPS will construct the name of the conflated topics produced.
The TopicFormat
must contain the string %n
, which is replaced with the name of the topic in the underlying regular expression topic.
For example, if the TopicFormat
is %n-C
, when the underlying regular expression topic contains a topic named /my/orders
, AMPS will produce a conflated topic with the name /my/orders-C
.
There is no default for this element. This element cannot contain characters that are significant for regular expressions (such as .
, ^
, and so on).
Below is an example that shows different approaches to defining a ConflatedTopic
:
<ConflatedTopic>
<Name>FastPublishTopic-C</Name>
<MessageType>nvfix</MessageType>
<UnderlyingTopic>FastPublishTopic</UnderlyingTopic>
<Interval>5s</Interval>
<Filter>/region = 'A'</Filter>
</ConflatedTopic>
<ConflatedTopic>
<Name>LongIntervalTopic-C</Name>
<MessageType>json</MessageType>
<UnderlyingTopic>FastPublishTopic</UnderlyingTopic>
<Interval>120s</Interval>
<HashIndex>
<Key>/order/status</Key>
</HashIndex>
</ConflatedTopic>
<ConflatedTopic>
<Name>ConflateUnderlyingRegex</Name>
<MessageType>bflat</MessageType>
<UnderlyingTopic>TheRegexTopic</UnderlyingTopic>
<Interval>20s</Interval>
</ConflatedTopic>