X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=PolicyEngineUtils%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Futils%2FBusConsumer.java;h=1b31394d0963650db1236fa42e00bbd7c4e49266;hp=bf92835c6a76ddaf6fcebec57077239a353c79b8;hb=80f072f60509ef3a35369a60857fe05f6c2a993a;hpb=c53fa990ea27ec074859eb94bcb7ec6deaa2157b 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 fetch() throws Exception; + public Iterable fetch() throws MRApiException; /** * close underlying library consumer @@ -48,8 +70,7 @@ public interface BusConsumer { public DmaapConsumerWrapper(List 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 fetch() throws Exception { - return this.consumer.fetch(); + public Iterable fetch() throws MRApiException { + try { + return this.consumer.fetch(); + } catch (Exception e) { + throw new MRApiException("Error during MR consumer Fetch ",e); + } } /**