JavaConfig 中 jms:listener-container 中的目标类型的等价物是什么? [英] What is the equivalent of destination-type from jms:listener-container in JavaConfig?
问题描述
JavaConfig 中 jms:listener-container
中的 destination-type
的等价物是什么?
What is the equivalent of destination-type
from jms:listener-container
in JavaConfig?
我已经在 API 中检查了以下两个类,但没有结果.
I have checked in the API these two following classes without results.
我正在尝试为主题创建消费者,网络上的许多教程都使用destination-type="topic"
I am trying to create consumers for a topic, many tutorials in the web use destination-type="topic"
根据23.6 JMS 命名空间支持部分,有表 23.2.JMS 元素的属性 表.destination-type 属性在哪里说:
According with the 23.6 JMS Namespace Support section, there is the Table 23.2. Attributes of the JMS element table. Where for the destination-type attribute says:
此侦听器的 JMS 目标类型:队列、主题或持久主题.默认为队列.
The JMS destination type for this listener: queue, topic or durableTopic. The default is queue.
对于观众:如果您尝试从 jms:listener-container
和 jms:listener
迁移 JavaConfig,请考虑以下两个链接.
For the audience: consider the two following links if you are trying to do a migration from jms:listener-container
and jms:listener
for JavaConfig.
推荐答案
如有疑问,请查看解析器(在本例中为 AbstractListenerContainerParser
);该属性不映射到单个属性,它映射到 pubSubDomain
和 subscriptionDurable
...
When in doubt, look at the parser (in this case AbstractListenerContainerParser
); that attribute doesn't map to a single property, it maps to pubSubDomain
and subscriptionDurable
...
String destinationType = ele.getAttribute(DESTINATION_TYPE_ATTRIBUTE);
boolean pubSubDomain = false;
boolean subscriptionDurable = false;
if (DESTINATION_TYPE_DURABLE_TOPIC.equals(destinationType)) {
pubSubDomain = true;
subscriptionDurable = true;
}
else if (DESTINATION_TYPE_TOPIC.equals(destinationType)) {
pubSubDomain = true;
}
else if ("".equals(destinationType) || DESTINATION_TYPE_QUEUE.equals(destinationType)) {
// the default: queue
}
else {
parserContext.getReaderContext().error("Invalid listener container 'destination-type': " +
"only \"queue\", \"topic\" and \"durableTopic\" supported.", ele);
}
configDef.getPropertyValues().add("pubSubDomain", pubSubDomain);
configDef.getPropertyValues().add("subscriptionDurable", subscriptionDurable);
这篇关于JavaConfig 中 jms:listener-container 中的目标类型的等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!