Messaged
This commit is contained in:
@@ -15,10 +15,12 @@ import org.redkale.service.LoadMode;
|
|||||||
* MQ资源注解, 只能标记在Service类方法上
|
* MQ资源注解, 只能标记在Service类方法上
|
||||||
* 1、方法必须是protected/public
|
* 1、方法必须是protected/public
|
||||||
* 2、方法不能是final/static
|
* 2、方法不能是final/static
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: https://redkale.org
|
* 详情见: https://redkale.org
|
||||||
*
|
*
|
||||||
|
* @see org.redkale.mq.ResourceConsumer
|
||||||
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class MessageModuleEngine extends ModuleEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addMessageConsumer(MessageConsumer consumer) {
|
void addMessageConsumer(MessageConsumer consumer) {
|
||||||
String agentName = consumer.getClass().getAnnotation(ResourceConsumer.class).mq();
|
String agentName = environment.getPropertyValue(consumer.getClass().getAnnotation(ResourceConsumer.class).mq());
|
||||||
agentConsumers.computeIfAbsent(agentName, v -> new CopyOnWriteArrayList<>()).add(consumer);
|
agentConsumers.computeIfAbsent(agentName, v -> new CopyOnWriteArrayList<>()).add(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ public class MessageModuleEngine extends ModuleEngine {
|
|||||||
@Override
|
@Override
|
||||||
public void load(ResourceFactory rf, String srcResourceName, Object srcObj, ResourceProducer annotation, Field field, Object attachment) {
|
public void load(ResourceFactory rf, String srcResourceName, Object srcObj, ResourceProducer annotation, Field field, Object attachment) {
|
||||||
if (field.getType() != MessageProducer.class) {
|
if (field.getType() != MessageProducer.class) {
|
||||||
throw new RestException("@" + ResourceProducer.class.getSimpleName()
|
throw new RestException("@" + ResourceProducer.class.getSimpleName()
|
||||||
+ " must on " + MessageProducer.class.getName() + " type field, but on " + field);
|
+ " must on " + MessageProducer.class.getName() + " type field, but on " + field);
|
||||||
}
|
}
|
||||||
MessageAgent agent = resourceFactory.find(annotation.mq(), MessageAgent.class);
|
MessageAgent agent = resourceFactory.find(annotation.mq(), MessageAgent.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user