2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.plugins.event.carrier.grpc;
23 import org.onap.policy.apex.service.engine.event.ApexEventException;
24 import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
25 import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException;
26 import org.onap.policy.apex.service.engine.event.ApexPluginsEventConsumer;
27 import org.onap.policy.apex.service.engine.event.PeeredReference;
28 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
29 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
32 * This class implements an Apex gRPC consumer. It is not expected to receive events using gRPC.
33 * So, initializing a gRPC consumer will result in error.
35 * @author Ajith Sreekumar (ajith.sreekumar@est.tech)
37 public class ApexGrpcConsumer extends ApexPluginsEventConsumer {
39 private static final String GRPC_CONSUMER_ERROR_MSG =
40 "A gRPC Consumer may not be specified. Only sending events is possible using gRPC";
43 public void init(final String consumerName, final EventHandlerParameters consumerParameters,
44 final ApexEventReceiver incomingEventReceiver) throws ApexEventException {
45 throw new ApexEventException(GRPC_CONSUMER_ERROR_MSG);
50 throw new ApexEventRuntimeException(GRPC_CONSUMER_ERROR_MSG);
55 throw new ApexEventRuntimeException(GRPC_CONSUMER_ERROR_MSG);
60 throw new ApexEventRuntimeException(GRPC_CONSUMER_ERROR_MSG);
64 public PeeredReference getPeeredReference(EventHandlerPeeredMode peeredMode) {
65 throw new ApexEventRuntimeException(GRPC_CONSUMER_ERROR_MSG);
69 public void setPeeredReference(EventHandlerPeeredMode peeredMode, PeeredReference peeredReference) {
70 throw new ApexEventRuntimeException(GRPC_CONSUMER_ERROR_MSG);