2 * ============LICENSE_START=======================================================
3 * DCAEGEN2-SERVICES-SDK
4 * ================================================================================
5 * Copyright (C) 2019 Nokia. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api;
22 import org.jetbrains.annotations.NotNull;
26 * Factory for High-Volume VES Producer.
34 * {@link HvVesProducer} producer = HvVesProducerFactory.create(
35 * {@link ImmutableProducerOptions}.builder().
40 * @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
43 public abstract class HvVesProducerFactory {
46 * Should not be used directly by client code. It is invoked internally by
47 * {@link HvVesProducerFactory#create(ProducerOptions)}.
49 * @param options the options to be used when creating a producer
50 * @return non-null HvVesProducer instance
53 protected abstract @NotNull HvVesProducer createProducer(ProducerOptions options);
56 * Creates an instance of {@link HvVesProducer}. Under the hood it first loads the HvVesProducerFactory instance
57 * using {@link java.util.ServiceLoader} facility. In order for this to work the implementation module should be present at the class
58 * path. Otherwise a runtime exception is thrown.
60 * @param options the options to be used when creating a producer
61 * @return non-null {@link HvVesProducer} instance
64 public static @NotNull HvVesProducer create(ProducerOptions options) {
65 return FactoryLoader.findInstance(HvVesProducerFactory.class).createProducer(options);