TrueRuleFilter Class

public final class TrueRuleFilter
extends SqlRuleFilter

Matches all the messages arriving to be selected for the subscription.

Sample: Create rule for all messages

The following code sample demonstrates how to create a rule. The "all-messages-subscription" subscription is associated with the TrueRuleFilter. So all messages sent to the topic are also received from the subscription.

String topicName = "my-existing-topic";
 String subscriptionName = "all-messages-subscription";
 String ruleName = "true-filter";

 RuleFilter alwaysTrueRule = new TrueRuleFilter();
 CreateRuleOptions createRuleOptions = new CreateRuleOptions()
     .setFilter(alwaysTrueRule);

 RuleProperties rule = client.createRule(topicName, ruleName, subscriptionName, createRuleOptions);

 System.out.printf("Rule '%s' created for topic %s, subscription %s. Filter: %s%n", rule.getName(), topicName,
     subscriptionName, rule.getFilter());

Constructor Summary

Constructor Description
TrueRuleFilter()

Initializes a new instance.

Method Summary

Modifier and Type Method and Description
String toString()

Converts the current instance to its string representation.

Methods inherited from SqlRuleFilter

Methods inherited from java.lang.Object

Constructor Details

TrueRuleFilter

public TrueRuleFilter()

Initializes a new instance.

Method Details

toString

public String toString()

Converts the current instance to its string representation.

Overrides:

TrueRuleFilter.toString()

Returns:

The string representation.

Applies to