summaryrefslogtreecommitdiffstats
path: root/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BusConsumer.java
diff options
context:
space:
mode:
Diffstat (limited to 'PolicyEngineUtils/src/main/java/org/onap/policy/utils/BusConsumer.java')
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/utils/BusConsumer.java37
1 files changed, 31 insertions, 6 deletions
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BusConsumer.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BusConsumer.java
index bf92835c6..1b31394d0 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BusConsumer.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BusConsumer.java
@@ -1,8 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PolicyEngineUtils
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.policy.utils;
+import java.net.MalformedURLException;
import java.util.List;
import java.util.Properties;
+import com.att.nsa.mr.client.MRClient.MRApiException;
import com.att.nsa.mr.client.impl.MRConsumerImpl;
import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
@@ -12,9 +34,9 @@ public interface BusConsumer {
* fetch messages
*
* @return list of messages
- * @throws Exception when error encountered by underlying libraries
+ * @throws MRApiException when error encountered by underlying libraries
*/
- public Iterable<String> fetch() throws Exception;
+ public Iterable<String> fetch() throws MRApiException;
/**
* close underlying library consumer
@@ -48,8 +70,7 @@ public interface BusConsumer {
public DmaapConsumerWrapper(List<String> servers, String topic,
String aafLogin, String aafPassword,
String consumerGroup, String consumerInstance,
- int fetchTimeout, int fetchLimit)
- throws Exception {
+ int fetchTimeout, int fetchLimit) throws MalformedURLException{
this.consumer = new MRConsumerImpl(servers, topic,
consumerGroup, consumerInstance,
@@ -70,8 +91,12 @@ public interface BusConsumer {
/**
* {@inheritDoc}
*/
- public Iterable<String> fetch() throws Exception {
- return this.consumer.fetch();
+ public Iterable<String> fetch() throws MRApiException {
+ try {
+ return this.consumer.fetch();
+ } catch (Exception e) {
+ throw new MRApiException("Error during MR consumer Fetch ",e);
+ }
}
/**