1 /*******************************************************************************
2 * ============LICENSE_START==================================================
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
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====================================================
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 ******************************************************************************/
25 package org.onap.dmaap.datarouter.node;
28 * Interface to allow independent testing of the DeliveryQueue code
30 * This interface represents all of the configuration information and
31 * feedback mechanisms that a delivery queue needs.
33 public interface DeliveryQueueHelper {
35 * Get the timeout (milliseconds) before retrying after an initial delivery failure
37 public long getInitFailureTimer();
40 * Get the ratio between timeouts on consecutive delivery attempts
42 public double getFailureBackoff();
45 * Get the maximum timeout (milliseconds) between delivery attempts
47 public long getMaxFailureTimer();
50 * Get the expiration timer (milliseconds) for deliveries
52 public long getExpirationTimer();
55 * Get the maximum number of file delivery attempts before checking
56 * if another queue has work to be performed.
58 public int getFairFileLimit();
61 * Get the maximum amount of time spent delivering files before checking if another queue has work to be performed.
63 public long getFairTimeLimit();
66 * Get the URL for delivering a file
68 * @param dest The destination information for the file to be delivered.
69 * @param fileid The file id for the file to be delivered.
70 * @return The URL for delivering the file (typically, dest.getURL() + "/" + fileid).
72 public String getDestURL(DestInfo dest, String fileid);
75 * Forget redirections associated with a subscriber
77 * @param dest Destination information to forget
79 public void handleUnreachable(DestInfo dest);
82 * Post redirection for a subscriber
84 * @param dest Destination information to update
85 * @param location Location given by subscriber
86 * @param fileid File ID of request
87 * @return true if this 3xx response is retryable, otherwise, false.
89 public boolean handleRedirection(DestInfo dest, String location, String fileid);
92 * Should I handle 3xx responses differently than 4xx responses?
94 public boolean isFollowRedirects();
97 * Get the feed ID for a subscription
99 * @param subid The subscription ID
100 * @return The feed ID
102 public String getFeedId(String subid);