2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2024 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.drools.pooling;
24 import org.onap.policy.drools.pooling.message.BucketAssignments;
25 import org.onap.policy.drools.pooling.message.Message;
26 import org.onap.policy.drools.pooling.state.State;
27 import org.onap.policy.drools.pooling.state.StateTimerTask;
30 * Pooling manager for a single PolicyController.
32 public interface PoolingManager {
35 * Gets the properties used to configure the manager.
37 * @return pooling properties
39 PoolingProperties getProperties();
49 * Gets the name of the internal DMaaP topic used by this manager to communicate with
52 * @return the name of the internal DMaaP topic
57 * Starts distributing requests according to the given bucket assignments.
59 * @param assignments must <i>not</i> be {@code null}
61 void startDistributing(BucketAssignments assignments);
64 * Gets the current bucket assignments.
66 * @return the current bucket assignments, or {@code null} if no assignments have been
69 BucketAssignments getAssignments();
72 * Publishes a message to the internal topic on the administrative channel.
74 * @param msg message to be published
76 void publishAdmin(Message msg);
79 * Publishes a message to the internal topic on a particular channel.
81 * @param channel channel on which the message should be published
82 * @param msg message to be published
84 void publish(String channel, Message msg);
87 * Schedules a timer to fire after a delay.
89 * @param delayMs delay, in milliseconds
91 * @return a new scheduled task
93 CancellableScheduledTask schedule(long delayMs, StateTimerTask task);
96 * Schedules a timer to fire repeatedly.
98 * @param initialDelayMs initial delay, in milliseconds
99 * @param delayMs delay, in milliseconds
101 * @return a new scheduled task
103 CancellableScheduledTask scheduleWithFixedDelay(long initialDelayMs, long delayMs, StateTimerTask task);
106 * Transitions to the "start" state.
108 * @return the new state
113 * Transitions to the "query" state.
115 * @return the new state
120 * Transitions to the "active" state.
122 * @return the new state
127 * Transitions to the "inactive" state.
129 * @return the new state