
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 jakarta.annotation.Nonnull; 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 @Nonnull 030 private String myProducerSuffix; 031 032 /** 033 * Constructor 034 */ 035 public ChannelProducerSettings() { 036 super(); 037 myProducerSuffix = ""; 038 } 039 040 public Integer getConcurrentConsumers() { 041 return myConcurrentConsumers; 042 } 043 044 // Spring Messaging Channels create the Consumer and Producer at the same time, so creating a producer 045 // also creates a consumer. This is why the producer has a concurrent consumer setting. 046 public ChannelProducerSettings setConcurrentConsumers(int theConcurrentConsumers) { 047 myConcurrentConsumers = theConcurrentConsumers; 048 return this; 049 } 050 051 /** 052 * In the case where the Message Broker adds a suffix to the channel name to define the producer name, this allows 053 * control of the suffix used. 054 */ 055 @Nonnull 056 public String getProducerNameSuffix() { 057 return myProducerSuffix; 058 } 059 060 /** 061 * In the case where the Message Broker adds a suffix to the channel name to define the producer name, this allows 062 * control of the suffix used. 063 */ 064 public ChannelProducerSettings setProducerNameSuffix(@Nonnull String theProducerNameSuffix) { 065 myProducerSuffix = theProducerNameSuffix; 066 return this; 067 } 068}