Module bus.extra

Class MQConfig

java.lang.Object
org.miaixz.bus.extra.mq.MQConfig
All Implemented Interfaces:
Serializable

public class MQConfig extends Object implements Serializable
Configuration class for Message Queue (MQ) settings. This class holds parameters required to connect to and interact with an MQ broker, such as the broker URL, additional properties, and an optional custom engine for specific MQ providers.
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Details

    • MQConfig

      public MQConfig(String brokerUrl)
      Constructs an MQConfig with the specified broker URL.
      Parameters:
      brokerUrl - The URL or address of the MQ broker.
  • Method Details

    • of

      public static MQConfig of(String brokerUrl)
      Creates a new MQConfig instance with the specified broker URL. This is a static factory method for convenient object creation.
      Parameters:
      brokerUrl - The URL or address of the MQ broker.
      Returns:
      A new MQConfig instance initialized with the given broker URL.
    • getBrokerUrl

      public String getBrokerUrl()
      Retrieves the broker URL configured for this MQ connection.
      Returns:
      The broker URL as a String.
    • setBrokerUrl

      public MQConfig setBrokerUrl(String brokerUrl)
      Sets the broker URL for this MQ configuration.
      Parameters:
      brokerUrl - The new broker URL to set.
      Returns:
      This MQConfig instance, allowing for method chaining.
    • getProperties

      public Properties getProperties()
      Retrieves the additional properties configured for this MQ connection.
      Returns:
      The Properties object containing additional configuration settings.
    • setProperties

      public MQConfig setProperties(Properties properties)
      Sets the additional properties for this MQ configuration.
      Parameters:
      properties - The Properties object to set.
      Returns:
      This MQConfig instance, allowing for method chaining.
    • addProperty

      public Properties addProperty(String key, String value)
      Adds a single property to the existing set of additional properties. If no properties object exists, a new one will be created.
      Parameters:
      key - The key of the property to add.
      value - The value of the property to add.
      Returns:
      The updated Properties object after adding the new property.
    • getCustomEngine

      public Class<? extends MQProvider> getCustomEngine()
      Retrieves the custom MQProvider engine class configured. This allows specifying a particular MQ implementation when multiple are available.
      Returns:
      The Class object representing the custom MQ provider engine.
    • setCustomEngine

      public MQConfig setCustomEngine(Class<? extends MQProvider> customEngine)
      Sets a custom MQProvider engine class to be used. This is useful for explicitly selecting an MQ implementation when multiple JAR packages are introduced.
      Parameters:
      customEngine - The Class object of the custom MQ provider engine.
      Returns:
      This MQConfig instance, allowing for method chaining.