Message filtering

Both the RAPCache and RAPStore subscribers can be configured to automatically filter certain messages. A rule definition specifies a message type (by it's ID, which is set in the template for that message type), whether the rule is an include rule or an exclude rule, and the condition. For include rules, only messages that match the condition are loaded. For exclude rules, messages that match the condition are excluded.

It is not valid to define both an include rule and an exclude rule for the same message type. However, the same message type can have multiple rules of the same type. These rules are defined by using multiple Rule tag blocks in the configuration XML file, as shown in the sample file below.

Message filtering is configured in messagefilter.xml. This file lives in the config directory of the RAP Cache and RAP Store. The file should be identical for both subscribers. There is a messagefilter.xsd file that is in the same directory.

The file below is a sample. The file shipped with the product does not contain any rules. It contains only the MessageFilter and RuleList tags.

 <?xml version="1.0" encoding="UTF-8"?>
	<MessageFilter>
		<RuleList>
			<Rule>
				<MessageType>4</MessageType>
				<RuleType>exclude</RuleType>
				<FieldRule>
					<FieldName>Exchange</FieldName>
					<FieldValue>NYSE</FieldValue>
				</FieldRule>
			</Rule>
			<Rule>
				<MessageType>13</MessageType>
				<RuleType>include</RuleType>
				<FieldRule>
					<FieldName>Symbol</FieldName>
					<FieldValue>SY</FieldValue>
				</FieldRule>
			</Rule>
		</RuleList>
</MessageFilter>

The following table explains the meaning of each of the XML elements in the template.

Table 1-5: Message Filterin Element Descriptions

Element

Description

MessageFilter

Root element for the message filters configuration file.

RuleList

A list of rules for filtering messages.

Rule

Contains conditions for a rule. Contains one MessageType element and zero or one FieldRule elements.

MessageType

The type of message to include/exclude.

RuleType

Indicates the type of rule. Valid values are:

  • exclude – if the rules holds true, exclude the message

  • include – if the rule holds true, include the message

FieldRule

Contains conditions for rules on a particular field.

FieldName

The name of the field to include/exclude when the value of the field matches FieldValue.

FieldValue

The value of the field to match. This value must be non-null.

  • If the value is a time, the format of the value must be hh:mm:ss or hh:mm:ss.sss

  • If the value is a date, the format must be YYYY-MM-DD

  • If the value is a DateTime, then the format must be YYYY-MM-DDThh:mm:ss or YYYY-MM-DDThh:mm:ss.sss