172678bd5343d44a4b22d43e17cfccaca4cb7479
[dmaap/datarouter.git] / datarouter-node / src / main / java / org / onap / dmaap / datarouter / node / DeliveryQueueHelper.java
1 /*******************************************************************************\r
2  * ============LICENSE_START==================================================\r
3  * * org.onap.dmaap\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 \r
24 \r
25 package org.onap.dmaap.datarouter.node;\r
26 \r
27 /**\r
28  *      Interface to allow independent testing of the DeliveryQueue code\r
29  *      <p>\r
30  *      This interface represents all of the configuration information and\r
31  *      feedback mechanisms that a delivery queue needs.\r
32  */\r
33 public interface        DeliveryQueueHelper     {\r
34         /**\r
35          *      Get the timeout (milliseconds) before retrying after an initial delivery failure\r
36          */\r
37         public long getInitFailureTimer();\r
38         /**\r
39          *      Get the ratio between timeouts on consecutive delivery attempts\r
40          */\r
41         public double   getFailureBackoff();\r
42         /**\r
43          *      Get the maximum timeout (milliseconds) between delivery attempts\r
44          */\r
45         public long     getMaxFailureTimer();\r
46         /**\r
47          *      Get the expiration timer (milliseconds) for deliveries\r
48          */\r
49         public long     getExpirationTimer();\r
50         /**\r
51          *      Get the maximum number of file delivery attempts before checking\r
52          *      if another queue has work to be performed.\r
53          */\r
54         public int getFairFileLimit();\r
55         /**\r
56          *      Get the maximum amount of time spent delivering files before checking if another queue has work to be performed.\r
57          */\r
58         public long getFairTimeLimit();\r
59         /**\r
60          *      Get the URL for delivering a file\r
61          *      @param dest     The destination information for the file to be delivered.\r
62          *      @param fileid   The file id for the file to be delivered.\r
63          *      @return The URL for delivering the file (typically, dest.getURL() + "/" + fileid).\r
64          */\r
65         public String   getDestURL(DestInfo dest, String fileid);\r
66         /**\r
67          *      Forget redirections associated with a subscriber\r
68          *      @param  dest    Destination information to forget\r
69          */\r
70         public void     handleUnreachable(DestInfo dest);\r
71         /**\r
72          *      Post redirection for a subscriber\r
73          *      @param  dest    Destination information to update\r
74          *      @param  location        Location given by subscriber\r
75          *      @param  fileid  File ID of request\r
76          *      @return true if this 3xx response is retryable, otherwise, false.\r
77          */\r
78         public boolean  handleRedirection(DestInfo dest, String location, String fileid);\r
79         /**\r
80          *      Should I handle 3xx responses differently than 4xx responses?\r
81          */\r
82         public boolean  isFollowRedirects();\r
83         /**\r
84          *      Get the feed ID for a subscription\r
85          *      @param subid    The subscription ID\r
86          *      @return The feed ID\r
87          */\r
88         public String getFeedId(String subid);\r
89 }\r