Skip to content

Configure AMQPConfig

Nathan Leach edited this page May 24, 2021 · 4 revisions

An example AMQPConfig element is shown below:

<AMQPConfig DefaultExchange="bar">
  <RecordSpecs>
	<Record Name="SAST_Scan_Summary">
		<MessageHeaders>
			<Header Key="RecordType" Spec="SAST_Scan_Summary" />
			<Header Key="ScanType" Spec="{ScanType}" />
		</MessageHeaders> 
	</Record>

	<Record Name="SAST_Scan_Detail" Exchange="foo" 
          TopicSpec="{ScanType}.{NodeId}.{Status}.{ResultSeverity}.{QueryLanguage}.{QueryName}">
		<Filter Mode="Reject">
			<Fields>
				<Field Name="NodeCodeSnippet"/>
			</Fields>
		</Filter>
		<MessageHeaders>
			<Header Key="RecordType" Spec="SAST_Scan_Detail" />
			<Header Key="ScanType" Spec="{ScanType}" />
		</MessageHeaders> 
	</Record>
  </RecordSpecs>
</AMQPConfig>


AMQPConfig Element

The top level element.

Attribute Name Required Default Description
DefaultExchange Y N/A The name of the MQ Exchange where records will be published unless overridden with a record-specific configuration.

RecordSpecs Element

A sub-element of the AMQPConfig containing zero or more Record elements.

Record Element

A sub-element of the RecordSpecs element. This defines record handling for a record matching the Name attribute. Records that do not have a specific record handler will be written to the default Exchange without any special handling.

Attribute Name Required Default Description
Name Y N/A The name of the record to match how the record is handled. The name must match the names of records configured in the CxAnalytixService configuration element or the CxAuditTrailRecords configuration element.
Exchange N DefaultExchange value The name of the exchange to use for this record type. If this attribute is not provided, the exchange named as the DefaultExchange is used.
TopicSpec N N/A A specification for forming a topic by combining static values and/or values from the record itself. Please see the Key Format Specifier for information about configuring the specifier string. This is commonly used to enable routing of messages using a Topic Exchange.

Filter Element

An optional sub-element of the Record element. Used to define a list of zero or more Field elements to filter and the method for filtering. This is used to limit the fields that are sent to the AMQP broker as part of the message.

Attribute Name Required Default Description
Mode Y N/A The filter operation mode. The value "Pass" means all fields defined in the Field sub-elements will be sent as a message to the AMQP broker and all other fields will be suppressed. The value "Reject" means all fields in the record will be sent to the AMQP broker except the fields defined in the Field sub-elements.

Fields Element

An optional sub-element of the Filter element. Contains zero or more Field elements.

Field Element

An optional sub-element of the Fields element. This defines the fields that will be used as part of the filtering operation.

Attribute Name Required Default Description
Name Y N/A The name of the field in the record that will be subject to the filtering operation.

MessageHeaders Element

An optional sub-element of the Record element. Contains list of zero or more Header elements with key/value pairs that will be used to set the AMQP message header. This is commonly used to enable routing of messages using a Header Exchange.

By default, one header Generation with the value of 0 is set regardless of if this element is provided or not. Headers with the key value of Generation set here are rejected.

Implementations made for recalculating derived data sets from replaying messages can utilize header exchanges to filter messages by Generation value. Generation 0 messages should always be considered as the initial data generation.

Header Element

An optional sub-element of the MessageHeaders element.

Attribute Name Required Default Description
Key Y N/A The name of the key value for the header.
Spec Y N/A The Key Format Specifier that forms the value assigned to the header when the message is sent to the AMQP broker.