我想为MDB配置 maxsession 所以在MDB类
上有一个下面的注释@ActivationConfigProperty(propertyName="maxSession",propertyValue="6")
片段
@MessageDriven
(activationConfig =
{
@ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "queue/MyQueue"),
@ActivationConfigProperty(propertyName = "reconnectAttempts",
propertyValue = "-1"),
@ActivationConfigProperty(propertyName = "setupAttempts",
propertyValue = "-1"),
@ActivationConfigProperty(propertyName="maxSession",propertyValue="6")
},
mappedName = "MyQueue"
)
我也在ejb-jar.xml中配置了maxsession
<?xml version='1.0' encoding='UTF-8'?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>MDBBean</ejb-name>
<ejb-class>com.mybean.MDBBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>maxSession</activation-config-property-name>
<activation-config-property-value>20</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>queue/MyQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
AFAIK优先显示给ejb-jar.xml,然后给注释。
但是当我通过jmx-console检查“ConsumerCount”时,显示26。 这意味着它会添加两个值。 如果我从cclass文件中删除@ActivationConfigProperty(propertyName =“maxSession”,propertyValue =“6”),它会显示35(即默认为15,然后从ejb-jar.xml中添加20)
我的要求是,它应该只从ejb-jar.xml中选择值。 注意:我不想从类中删除注释,因为在另一个AS上使用相同的代码。