All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.reactivemessaging.http.runtime.QuarkusHttpConnectorIncomingConfiguration Maven / Gradle / Ivy

package io.quarkus.reactivemessaging.http.runtime;

import java.util.Optional;
import org.eclipse.microprofile.config.Config;

/**
 * Extract the incoming configuration for the {@code quarkus-http} connector.
*/
public class QuarkusHttpConnectorIncomingConfiguration extends QuarkusHttpConnectorCommonConfiguration {

  /**
   * Creates a new QuarkusHttpConnectorIncomingConfiguration.
   */
  public QuarkusHttpConnectorIncomingConfiguration(Config config) {
    super(config);
    validate();
  }

  /**
  * Gets the path value from the configuration.
  * Attribute Name: path
  * Description: The path of the endpoint
  * Mandatory: yes
  * @return the path
  */
  public String getPath() {
    return config.getOptionalValue("path", String.class)
        .orElseThrow(() -> new IllegalArgumentException("The attribute `path` on connector 'quarkus-http' (channel: " + getChannel() + ") must be set"));
  }

  /**
  * Gets the buffer-size value from the configuration.
  * Attribute Name: buffer-size
  * Description: HTTP endpoint buffers messages if a consumer is not able to keep up. This setting specifies the size of the buffer.
  * Default Value: 8
  * @return the buffer-size
  */
  public String getBufferSize() {
    return config.getOptionalValue("buffer-size", String.class)
     .orElse("8");
  }

  /**
  * Gets the broadcast value from the configuration.
  * Attribute Name: broadcast
  * Description: Whether the messages should be dispatched to multiple consumers
  * Default Value: false
  * @return the broadcast
  */
  public Boolean getBroadcast() {
    return config.getOptionalValue("broadcast", Boolean.class)
     .orElse(Boolean.valueOf("false"));
  }

  public void validate() {
    super.validate();
    getPath();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy