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());
 
See Also:
  • Constructor Details

    • TrueRuleFilter

      public TrueRuleFilter()
      Initializes a new instance.
  • Method Details

    • toString

      public String toString()
      Converts the current instance to its string representation.
      Overrides:
      toString in class SqlRuleFilter
      Returns:
      The string representation.