[DMAAP-DR] Remove cadi/aaf from dr-node
[dmaap/datarouter.git] / datarouter-node / src / main / java / org / onap / dmaap / datarouter / node / delivery / DeliveryQueueHelper.java
1 /*******************************************************************************
2  * ============LICENSE_START==================================================
3  * * org.onap.dmaap
4  * * ===========================================================================
5  * * Copyright © 2017 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
10  * *
11  *  *      http://www.apache.org/licenses/LICENSE-2.0
12  * *
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====================================================
19  * *
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21  * *
22  ******************************************************************************/
23
24
25 package org.onap.dmaap.datarouter.node.delivery;
26
27 import org.onap.dmaap.datarouter.node.DestInfo;
28
29 /**
30  * Interface to allow independent testing of the DeliveryQueue code
31  *
32  * <p>This interface represents all of the configuration information and
33  * feedback mechanisms that a delivery queue needs.
34  */
35 public interface DeliveryQueueHelper {
36     /**
37      * Get the timeout (milliseconds) before retrying after an initial delivery failure.
38      */
39     long getInitFailureTimer();
40
41     /**
42      * Get the timeout before retrying after delivery and wait for file processing.
43      */
44     long getWaitForFileProcessFailureTimer();
45
46     /**
47      * Get the ratio between timeouts on consecutive delivery attempts.
48      */
49     double getFailureBackoff();
50
51     /**
52      * Get the maximum timeout (milliseconds) between delivery attempts.
53      */
54     long getMaxFailureTimer();
55
56     /**
57      * Get the expiration timer (milliseconds) for deliveries.
58      */
59     long getExpirationTimer();
60
61     /**
62      * Get the maximum number of file delivery attempts before checking
63      * if another queue has work to be performed.
64      */
65     int getFairFileLimit();
66
67     /**
68      * Get the maximum amount of time spent delivering files before checking if another queue has work to be performed.
69      */
70     long getFairTimeLimit();
71
72     /**
73      * Get the URL for delivering a file.
74      *
75      * @param destinationInfo   The destination information for the file to be delivered.
76      * @param fileid The file id for the file to be delivered.
77      * @return The URL for delivering the file (typically, destinationInfo.getURL() + "/" + fileid).
78      */
79     String getDestURL(DestInfo destinationInfo, String fileid);
80
81     /**
82      * Forget redirections associated with a subscriber.
83      *
84      * @param    destinationInfo    Destination information to forget
85      */
86     void handleUnreachable(DestInfo destinationInfo);
87
88     /**
89      * Post redirection for a subscriber.
90      *
91      * @param    destinationInfo    Destination information to update
92      * @param    location    Location given by subscriber
93      * @param    fileid    File ID of request
94      * @return true if this 3xx response is retryable, otherwise, false.
95      */
96     boolean handleRedirection(DestInfo destinationInfo, String location, String fileid);
97
98     /**
99      * Should I handle 3xx responses differently than 4xx responses?.
100      */
101     boolean isFollowRedirects();
102
103     /**
104      * Get the feed ID for a subscription.
105      *
106      * @param subid The subscription ID
107      * @return The feed ID
108      */
109     String getFeedId(String subid);
110 }