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