2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.drools.pooling;
23 import java.util.Properties;
24 import org.onap.policy.common.utils.properties.SpecPropertyConfiguration;
25 import org.onap.policy.common.utils.properties.exception.PropertyException;
28 * Properties used by the pooling feature, specific to a controller.
30 public class PoolingProperties extends SpecPropertyConfiguration {
33 * The feature name, used to retrieve properties.
35 public static final String FEATURE_NAME = "feature-pooling-dmaap";
38 * Feature properties all begin with this prefix.
40 public static final String PREFIX = "pooling.";
43 * These properties are not used by a SpecPropertyConfiguration, thus
44 * they do not use any of the "{xxx}" forms.
46 public static final String FEATURE_ENABLED = PREFIX + "enabled";
49 * These properties REQUIRE a controller name, thus they use the "{$}" form.
51 public static final String POOLING_TOPIC = PREFIX + "{$}.topic";
54 * These properties allow the controller name to be left out, thus they use
55 * the "{prefix?suffix}" form.
57 public static final String OFFLINE_LIMIT = PREFIX + "{?.}offline.queue.limit";
58 public static final String OFFLINE_AGE_MS = PREFIX + "{?.}offline.queue.age.milliseconds";
59 public static final String OFFLINE_PUB_WAIT_MS = PREFIX + "{?.}offline.publish.wait.milliseconds";
60 public static final String START_HEARTBEAT_MS = PREFIX + "{?.}start.heartbeat.milliseconds";
61 public static final String REACTIVATE_MS = PREFIX + "{?.}reactivate.milliseconds";
62 public static final String IDENTIFICATION_MS = PREFIX + "{?.}identification.milliseconds";
63 public static final String ACTIVE_HEARTBEAT_MS = PREFIX + "{?.}active.heartbeat.milliseconds";
64 public static final String INTER_HEARTBEAT_MS = PREFIX + "{?.}inter.heartbeat.milliseconds";
67 * Type of item that the extractors will be extracting.
69 public static final String EXTRACTOR_TYPE = "requestId";
72 * Prefix for extractor properties.
74 public static final String PROP_EXTRACTOR_PREFIX = "extractor." + EXTRACTOR_TYPE;
77 * Properties from which this was constructed.
79 private Properties source;
82 * Topic used for inter-host communication.
84 @Property(name = POOLING_TOPIC)
85 private String poolingTopic;
88 * Maximum number of events to retain in the queue while waiting for
89 * buckets to be assigned.
91 @Property(name = OFFLINE_LIMIT, defaultValue = "1000")
92 private int offlineLimit;
95 * Maximum age, in milliseconds, of events to be retained in the queue.
96 * Events older than this are discarded.
98 @Property(name = OFFLINE_AGE_MS, defaultValue = "60000")
99 private long offlineAgeMs;
102 * Time, in milliseconds, to wait for an "Offline" message to be published
105 @Property(name = OFFLINE_PUB_WAIT_MS, defaultValue = "3000")
106 private long offlinePubWaitMs;
109 * Time, in milliseconds, to wait for this host's heart beat during the
112 @Property(name = START_HEARTBEAT_MS, defaultValue = "100000")
113 private long startHeartbeatMs;
116 * Time, in milliseconds, to wait before attempting to re-active this
117 * host when it has no bucket assignments.
119 @Property(name = REACTIVATE_MS, defaultValue = "50000")
120 private long reactivateMs;
123 * Time, in milliseconds, to wait for all Identification messages to
124 * arrive during the query state.
126 @Property(name = IDENTIFICATION_MS, defaultValue = "50000")
127 private long identificationMs;
130 * Time, in milliseconds, to wait for heart beats from this host, or its
131 * predecessor, during the active state.
133 @Property(name = ACTIVE_HEARTBEAT_MS, defaultValue = "50000")
134 private long activeHeartbeatMs;
137 * Time, in milliseconds, to wait between heart beat generations during
138 * the active and start-up states.
140 @Property(name = INTER_HEARTBEAT_MS, defaultValue = "15000")
141 private long interHeartbeatMs;
144 * @param controllerName the name of the controller
145 * @param props set of properties used to configure this
146 * @throws PropertyException if an error occurs
149 public PoolingProperties(String controllerName, Properties props) throws PropertyException {
150 super(controllerName, props);
155 public Properties getSource() {
159 public String getPoolingTopic() {
163 public int getOfflineLimit() {
167 public long getOfflineAgeMs() {
171 public long getOfflinePubWaitMs() {
172 return offlinePubWaitMs;
175 public long getStartHeartbeatMs() {
176 return startHeartbeatMs;
179 public long getReactivateMs() {
183 public long getIdentificationMs() {
184 return identificationMs;
187 public long getActiveHeartbeatMs() {
188 return activeHeartbeatMs;
191 public long getInterHeartbeatMs() {
192 return interHeartbeatMs;
195 public void setPoolingTopic(String poolingTopic) {
196 this.poolingTopic = poolingTopic;
199 public void setOfflineLimit(int offlineLimit) {
200 this.offlineLimit = offlineLimit;
203 public void setOfflineAgeMs(long offlineAgeMs) {
204 this.offlineAgeMs = offlineAgeMs;
207 public void setOfflinePubWaitMs(long offlinePubWaitMs) {
208 this.offlinePubWaitMs = offlinePubWaitMs;
211 public void setStartHeartbeatMs(long startHeartbeatMs) {
212 this.startHeartbeatMs = startHeartbeatMs;
215 public void setReactivateMs(long reactivateMs) {
216 this.reactivateMs = reactivateMs;
219 public void setIdentificationMs(long identificationMs) {
220 this.identificationMs = identificationMs;
223 public void setActiveHeartbeatMs(long activeHeartbeatMs) {
224 this.activeHeartbeatMs = activeHeartbeatMs;
227 public void setInterHeartbeatMs(long interHeartbeatMs) {
228 this.interHeartbeatMs = interHeartbeatMs;