code: public int addRule(final SubscriptionRequestRule rule) {
  		Integer theRuleNum = Integer.valueOf(this.nextRuleNum.getAndIncrement());
  		synchronized (this.ruleMap) {
  			if (!this.ruleMap.values().contains(rule)) {
  				this.ruleMap.put(theRuleNum, rule);
  				
  				SubscriptionRequestRule[] newRules = this.ruleMap.values().toArray(new SubscriptionRequestRule[]{});
  				this.agg.setRules(newRules);
  				if (this.agg.isConnected()) {
  					SubscriptionMessage msg = new SubscriptionMessage();
  					msg.setRules(new SubscriptionRequestRule[] { rule });
  					msg.setMessageType(SubscriptionMessage.SUBSCRIPTION_MESSAGE_ID);
  					this.agg.getSession().write(msg);
  				}
  				
  				return theRuleNum.intValue();
  			}
  			log.warn("Rule {} is already configured for use.", rule);
  			return -1;
  		}
  	}
docs: Adds a Subscription Request Rule to the aggregator interface. If the
  aggregator is already connected, the rule will be sent immediately,
  otherwise it will be sent with all rules when the aggregator is
  connected.
  
  @param rule
  the rule to add to this aggregator.
  @return the rule number, which can be used later to remove a Subscription
  Request Rule.