001/*-
002 * #%L
003 * HAPI FHIR Storage api
004 * %%
005 * Copyright (C) 2014 - 2025 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.broker.api;
021
022import javax.annotation.Nullable;
023
024public class ChannelProducerSettings extends BaseChannelSettings {
025        public static final Integer DEFAULT_CHANNEL_CONSUMERS = 2;
026
027        private Integer myConcurrentConsumers = DEFAULT_CHANNEL_CONSUMERS;
028
029        @Nullable
030        private String myProducerSuffix;
031
032        /**
033         * Constructor
034         */
035        public ChannelProducerSettings() {
036                super();
037        }
038
039        public Integer getConcurrentConsumers() {
040                return myConcurrentConsumers;
041        }
042
043        // Spring Messaging Channels create the Consumer and Producer at the same time, so creating a producer
044        // also creates a consumer. This is why the producer has a concurrent consumer setting.
045        public ChannelProducerSettings setConcurrentConsumers(int theConcurrentConsumers) {
046                myConcurrentConsumers = theConcurrentConsumers;
047                return this;
048        }
049
050        /**
051         *      In the case where the Message Broker adds a suffix to the channel name to define the producer name, this allows
052         *      control of the suffix used.
053         */
054        @Nullable
055        public String getProducerNameSuffix() {
056                return myProducerSuffix;
057        }
058
059        /**
060         *      In the case where the Message Broker adds a suffix to the channel name to define the producer name, this allows
061         *      control of the suffix used.
062         */
063        public ChannelProducerSettings setProducerNameSuffix(@Nullable String theProducerNameSuffix) {
064                myProducerSuffix = theProducerNameSuffix;
065                return this;
066        }
067}