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 java.util.Properties;
24 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
25 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
28 * This interface is used by technology specific producers and publishers that are handling events
29 * output by Apex. Users specify the producer technology to use in the Apex configuration and Apex
30 * uses a factory to start the appropriate producer plugin that implements this interface for its
31 * output. The technology specific implementation details are hidden behind this interface.
33 * @author Liam Fallon (liam.fallon@ericsson.com)
35 public interface ApexEventProducer {
38 * Initialize the producer.
40 * @param name a name for this producer
41 * @param producerParameters the parameters to initialise this producer
42 * @throws ApexEventException exception on errors initializing an event producer
44 void init(String name, EventHandlerParameters producerParameters) throws ApexEventException;
47 * Get the peered reference object for this producer.
49 * @param peeredMode the peered mode for which to return the reference
50 * @return the peered reference object for this producer
52 PeeredReference getPeeredReference(EventHandlerPeeredMode peeredMode);
55 * Set the peered reference object for this producer.
57 * @param peeredMode the peered mode for which to return the reference
58 * @param peeredReference the peered reference object for this producer
60 void setPeeredReference(EventHandlerPeeredMode peeredMode, PeeredReference peeredReference);
63 * Send an event to the producer.
65 * @param executionId the unique ID that produced this event
66 * @param executionProperties properties used during processing of this event
67 * @param eventName The name of the event
68 * @param event The converted event as an object
70 void sendEvent(long executionId, Properties executionProperties, String eventName, Object event);
73 * Get the name of this event producer.
75 * @return the event producer name
80 * Stop the event producer.