java.lang.Object
org.miaixz.bus.extra.mq.MQConfig
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProperty(String key, String value) Adds a single property to the existing set of additional properties.Retrieves the broker URL configured for this MQ connection.Class<? extends MQProvider> Retrieves the customMQProviderengine class configured.Retrieves the additional properties configured for this MQ connection.static MQConfigCreates a newMQConfiginstance with the specified broker URL.setBrokerUrl(String brokerUrl) Sets the broker URL for this MQ configuration.setCustomEngine(Class<? extends MQProvider> customEngine) Sets a customMQProviderengine class to be used.setProperties(Properties properties) Sets the additional properties for this MQ configuration.
-
Constructor Details
-
MQConfig
Constructs anMQConfigwith the specified broker URL.- Parameters:
brokerUrl- The URL or address of the MQ broker.
-
-
Method Details
-
of
Creates a newMQConfiginstance 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
MQConfiginstance initialized with the given broker URL.
-
getBrokerUrl
Retrieves the broker URL configured for this MQ connection.- Returns:
- The broker URL as a
String.
-
setBrokerUrl
Sets the broker URL for this MQ configuration.- Parameters:
brokerUrl- The new broker URL to set.- Returns:
- This
MQConfiginstance, allowing for method chaining.
-
getProperties
Retrieves the additional properties configured for this MQ connection.- Returns:
- The
Propertiesobject containing additional configuration settings.
-
setProperties
Sets the additional properties for this MQ configuration.- Parameters:
properties- ThePropertiesobject to set.- Returns:
- This
MQConfiginstance, allowing for method chaining.
-
addProperty
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
Propertiesobject after adding the new property.
-
getCustomEngine
Retrieves the customMQProviderengine class configured. This allows specifying a particular MQ implementation when multiple are available.- Returns:
- The
Classobject representing the custom MQ provider engine.
-
setCustomEngine
Sets a customMQProviderengine class to be used. This is useful for explicitly selecting an MQ implementation when multiple JAR packages are introduced.- Parameters:
customEngine- TheClassobject of the custom MQ provider engine.- Returns:
- This
MQConfiginstance, allowing for method chaining.
-