001/*-
002 * #%L
003 * Smile CDR - CDR
004 * %%
005 * Copyright (C) 2016 - 2024 Smile CDR, Inc.
006 * %%
007 * All rights reserved.
008 * #L%
009 */
010package ca.cdr.api.camel;
011
012import org.apache.camel.Exchange;
013
014import java.util.Map;
015import java.util.concurrent.CompletableFuture;
016
017/**
018 * Service to send messages to camel module routes.
019 * Can be autowired from hybrid providers.
020 */
021public interface ICamelRouteEndpointSvc {
022
023        /**
024         * Send asynchronous request to camel module/route specified.
025         * This method has been marked as deprecated.
026         * Please use {@link ICamelRouteEndpointSvc#send(String, String, Object, Map)} instead.
027         * @param theModuleId the camel target module ID
028         * @param theDirectRouteName the camel target module route ID
029         * @param theInput the input object
030         * @param theHeaders the request headers
031         * @return CompletableFuture the asynchronous send response body
032         */
033        @Deprecated(since = "2024.08")
034        CompletableFuture<Object> sendToCamelRoute(
035                        String theModuleId, String theDirectRouteName, Object theInput, Map<String, Object> theHeaders);
036
037        /**
038         * Send a Camel message to a direct endpoint available in the specified module using the provided body and headers.
039         * Please note that the direct directive will be added if not present in the endpoint uri.
040         * @param theModuleId the target module id
041         * @param theEndpointUri the endpoint uri
042         * @param theInput the body object
043         * @param theHeaders the headers to include in the message
044         * @return the returned Exchange object
045         */
046        Exchange send(String theModuleId, String theEndpointUri, Object theInput, Map<String, Object> theHeaders);
047}