之前定义:
1. 在MqConstant中定义topic;
2. 在mq-listener中定义topic的监听,这时要重新写一遍topic的字符串;(可能会造成constant和此处两个字符串的维护困难)
3. 在相应位置发送topic事件,使用了constant中的常量定义。
当前修改:
1. 去除MqConstant定义,改用mqTopic.xml注入定义;
<!--小区添加事件-->
<bean id="mqCommunityPropertyCommunityAdded" class="java.lang.String">
<constructor-arg value="community.property.community.add"/>
</bean>
2. 在mq-listener中定义topic的监听,直接引用mqTopic.xml的bean,如:
<jms:listener destination="#{mqCommunityPropertyCommunityAdded}" ref="communityAddListener" />
3. 在相应位置发送topic事件,使用此bean定义:
@Autowired
private String mqCommunityPropertyCommunityAdded;
mqUtil.topicObjectSend(mqCommunityPropertyCommunityAdded, record);