001/*-
002 * #%L
003 * Smile CDR - CDR
004 * %%
005 * Copyright (C) 2016 - 2025 Smile CDR, Inc.
006 * %%
007 * All rights reserved.
008 * #L%
009 */
010package ca.cdr.api.broker;
011
012import ca.cdr.api.annotations.CdrPublicAPI;
013
014import java.util.Map;
015
016@CdrPublicAPI
017public interface IPublicBrokerSender {
018        default <P> void send(IPublicBrokerSendRequest<P> theSendRequest) throws Exception {
019                // Default implementation for backwards compatibility
020                send(theSendRequest.getChannelName(), theSendRequest.getPayload().toString(), theSendRequest.getHeaders());
021        }
022
023        /**
024         * Allows sending a plain string payload with headers to the configured broker.
025         *
026         * @deprecated use {@link #send(IPublicBrokerSendRequest)}
027         *
028         * @param theTopic the Topic
029         * @param thePayload message payload
030         * @param theHeaders the message headers
031         */
032        @Deprecated
033        default void send(String theTopic, String thePayload, Map<String, Object> theHeaders) throws Exception {
034                throw new UnsupportedOperationException();
035        }
036}