java.lang.Object
org.miaixz.bus.extra.mq.MQFactory
Factory class for creating and managing Message Queue (MQ) engine objects. This factory provides a mechanism to
automatically detect and instantiate appropriate
MQProvider implementations based on available JARs or
explicit configuration.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MQProvidercreateEngine(MQConfig config) Creates anMQProviderinstance based on the providedMQConfig.
-
Constructor Details
-
MQFactory
public MQFactory()
-
-
Method Details
-
createEngine
Creates anMQProviderinstance based on the providedMQConfig. This method attempts to automatically detect the correct MQ engine implementation from the classpath or uses a custom engine if specified in the configuration. It is recommended to manage the lifecycle of the returned engine, potentially as a singleton, as this method creates a new instance on each call.- Parameters:
config- TheMQConfigcontaining connection details and optional custom engine class.- Returns:
- A new
MQProviderinstance initialized with the given configuration. - Throws:
org.miaixz.bus.core.lang.exception.MQueueException- if no suitable MQ implementation is found or cannot be instantiated.
-