Interface IAwsSqsFilterPolicyBuilder
Fluent builder interface for configuring SNS subscription filter policies.
public interface IAwsSqsFilterPolicyBuilder
- Extension Methods
Examples
sub.FilterPolicy(filter =>
{
filter.OnMessageAttributes()
.Attribute("priority").Equals("high")
.Attribute("region").Prefix("us-")
.Attribute("amount").GreaterThan(100);
});
Remarks
This interface follows the Microsoft-style fluent builder pattern. It provides a fluent API for building AWS SNS filter policies with proper operator support.
Filter policies allow selective message delivery based on message attributes. AWS supports operators including exact match, prefix, suffix, exists, anything-but, and numeric comparisons.
AWS SNS limits filter policies to 5 attribute names with a total of 150 values.
Methods
Attribute(string)
Begins configuration for a specific attribute.
IAwsSqsFilterAttributeBuilder Attribute(string attributeName)
Parameters
attributeNamestringThe name of the attribute to filter on.
Returns
- IAwsSqsFilterAttributeBuilder
An attribute builder for configuring conditions.
Examples
filter.Attribute("priority").Equals("high").Or().Equals("urgent");
filter.Attribute("region").Prefix("us-");
Remarks
Each attribute can have multiple conditions that are OR'd together. Conditions across different attributes are AND'd together.
Exceptions
- ArgumentException
Thrown when
attributeNameis null, empty, or whitespace.
OnMessageAttributes()
Sets the filter policy to evaluate against message attributes (default).
IAwsSqsFilterPolicyBuilder OnMessageAttributes()
Returns
- IAwsSqsFilterPolicyBuilder
The builder for fluent chaining.
Remarks
Message attribute filtering is the default mode and filters based on SNS message attributes.
OnMessageBody()
Sets the filter policy to evaluate against the message body.
IAwsSqsFilterPolicyBuilder OnMessageBody()
Returns
- IAwsSqsFilterPolicyBuilder
The builder for fluent chaining.
Remarks
Message body filtering requires the message body to be valid JSON. The filter conditions are applied to JSON paths in the message body.