2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
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.service.engine.event;
23 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
24 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
27 * This interface is used by technology specific producers and publishers that are handling events
28 * output by Apex. Users specify the producer technology to use in the Apex configuration and Apex
29 * uses a factory to start the appropriate producer plugin that implements this interface for its
30 * output. The technology specific implementation details are hidden behind this interface.
32 * @author Liam Fallon (liam.fallon@ericsson.com)
34 public interface ApexEventProducer {
37 * Initialize the producer.
39 * @param name a name for this producer
40 * @param producerParameters the parameters to initialise this producer
41 * @throws ApexEventException exception on errors initializing an event producer
43 void init(String name, EventHandlerParameters producerParameters) throws ApexEventException;
46 * Get the peered reference object for this producer.
48 * @param peeredMode the peered mode for which to return the reference
49 * @return the peered reference object for this producer
51 PeeredReference getPeeredReference(EventHandlerPeeredMode peeredMode);
54 * Set the peered reference object for this producer.
56 * @param peeredMode the peered mode for which to return the reference
57 * @param peeredReference the peered reference object for this producer
59 void setPeeredReference(EventHandlerPeeredMode peeredMode, PeeredReference peeredReference);
62 * Send an event to the producer.
64 * @param executionId the unique ID that produced this event
65 * @param eventName The name of the event
66 * @param event The converted event as an object
68 void sendEvent(long executionId, String eventName, Object event);
71 * Get the name of this event producer.
73 * @return the event producer name
78 * Stop the event producer.