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 DeliveryTask code.
30 * This interface represents all the configuraiton information and
31 * feedback mechanisms that a delivery task needs.
34 public interface DeliveryTaskHelper {
36 * Report that a delivery attempt failed due to an exception (like can't connect to remote host)
38 * @param task The task that failed
39 * @param exception The exception that occurred
41 public void reportException(DeliveryTask task, Exception exception);
44 * Report that a delivery attempt completed (successfully or unsuccessfully)
46 * @param task The task that failed
47 * @param status The HTTP status
48 * @param xpubid The publish ID from the far end (if any)
49 * @param location The redirection location for a 3XX response
51 public void reportStatus(DeliveryTask task, int status, String xpubid, String location);
54 * Report that a delivery attempt either failed while sending data or that an error was returned instead of a 100 Continue.
56 * @param task The task that failed
57 * @param sent The number of bytes sent or -1 if an error was returned instead of 100 Continue.
59 public void reportDeliveryExtra(DeliveryTask task, long sent);
62 * Get the destination information for the delivery queue
64 * @return The destination information
66 public DestInfo getDestInfo();
69 * Given a file ID, get the URL to deliver to
71 * @param fileid The file id
72 * @return The URL to deliver to
74 public String getDestURL(String fileid);
77 * Get the feed ID for a subscription
79 * @param subid The subscription ID
82 public String getFeedId(String subid);