service-spring-mq.xml 1.4 KB
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans.xsd ">
    <!-- 初始化MQ主题环镜 (必须放在生产者和消费者前面)-->
    <bean id="topicEnvBean" class="com.doubo.ali.mq.topic.env.TopicEnvBean">
        <property name="topicEnv">
            <bean class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean">
                <property name="staticField" value="${mq.topicEnv}" />
            </bean>
        </property>
    </bean>


    <!-- mq 日志配置 -->
    <bean class="com.doubo.ali.mq.config.RocketMqLoggerConfigBean">
        <property name="logRoot" value="${mq.logRoot}"/>
        <property name="logLevel" value="${mq.logLevel}"/>
        <property name="logMaxIndex" value="${mq.logMaxIndex}"/>
    </bean>

    <!-- 生产者 -->
    <bean id="producer" class="com.doubo.ali.mq.producer.RocketMqProducerBean" init-method="start" destroy-method="shutdown">
        <property name="properties">
            <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
                <property name="location" value="classpath:META-INF/conf/mq-producer.properties"/>
            </bean>
        </property>
    </bean>

</beans>