2012-10-18 83 views
1

我不能夠配置Geronimo的/ ActiveMQ的讓超過10條消息一次過處理。配置Geronimos MDB InstanceLimit

我嘗試了這個mailing list, 的建議,但將maxSessions設置爲高於10的值並沒有任何效果。將其設置爲較低的東西比有效果,但...

而且I'tried通過設置來設置InstanceLimit

<module name="org.apache.geronimo.configs/j2ee-server/2.1.4/car"> 
    <gbean name="org.apache.geronimo.configs/j2ee-server/2.1.4/car?ServiceModule=org.apache.geronimo.configs/j2ee-server/2.1.4/car,j2eeType=GBean,name=CustomPropertiesGBean" 
      gbeanInfo="org.apache.geronimo.system.properties.SystemProperties"> 
     <attribute name="systemProperties">Default\ MDB\ Container.InstanceLimit=50</attribute> 
    </gbean> 
</module> 

回答

1

好吧,我終於得到了它!這是一個冗長的解釋,希望能幫助別人。

these examples周圍修修補補之後我想通了,ActiveMQ的激活參數犯規限制的上限,我們雖然可以減少並行實例:

<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-property> 
    <activation-config-property-name>maxSessions</activation-config-property-name> 
    <activation-config-property-value>3</activation-config-property-value> 
</activation-config-property> 
<activation-config-property> 
    <activation-config-property-name>maxMessagesPerSessions</activation-config-property-name> 
    <activation-config-property-value>2</activation-config-property-value> 
</activation-config-property> 

所以我決定走開放源代碼之路!連接所涉及的組件的所有所需的源代碼後:

  • Geronimo的
  • ActiveMQ的
  • OpenEJB的

中去了,我想通了堆棧跟蹤,該InstanceLimit是GBean的屬性,它是明確詢問。它的缺省值是10,它在Geronimo中硬編碼。通過在調試器中調用這個值,我得到了希望的結果!

但設置InstanceLimit還建議,其中建議將它添加到Geronimos config.xml中

<module name="org.apache.geronimo.configs/j2ee-server/2.1.4/car"> 
    <gbean name="org.apache.geronimo.configs/j2ee-server/2.1.4/car?ServiceModule=org.apache.geronimo.configs/j2ee-server/2.1.4/car,j2eeType=GBean,name=CustomPropertiesGBean" 
      gbeanInfo="org.apache.geronimo.system.properties.SystemProperties"> 
     <attribute name="systemProperties">Default\ MDB\ Container.InstanceLimit=50</attribute> 
    </gbean> 
</module> 

(當然用正確的版本號) 的mailing list但是這並沒有任何效果。經過仔細的閱讀此hint

嘗試MdbContainer的InstanceLimit屬性設置爲0,從而沒有創建的實例相匹配的無AMQ會話使用。設置此,你需要設置爲系統財產,是財產應containerId.InstanceLimit其中數據筒的格式爲

<artifactId>.<Resource Group Name>-<listener interface>

如:org.apache.geronimo.configs/ActiveMQ的-ra/2.2-SNAPSHOT/car.ActiveMQ RA-一個javax.jms.MessageListener

  • 的JMS RA的<artifactId> = artifactId的
  • <Resource Group Name> - 資源組名稱在創建RA
  • <listener interface>ü給 - 的javax.jms。消息監聽在這種情況下

和檢查Geronimos代碼和運行狀態,我想通了,它是在org.apache.geronimo.openejb.OpenEjbSystemGBean線309尋找InstanceLimit,具有destinct ID這是在示例項目:

org.apache。 geronimo.configs/ActiveMQ的-RA/2.2.1/car.ActiveMQ RA-一個javax.jms.MessageListener

配備有這個信息,我這個做了嘗試:

<module name="org.apache.geronimo.configs/j2ee-server/2.2.1/car"> 
    <gbean name="org.apache.geronimo.configs/j2ee-server/2.2.1/car?ServiceModule=org.apache.geronimo.configs/j2ee-server/2.2.1/car,j2eeType=GBean,name=CustomPropertiesGBean" 
       gbeanInfo="org.apache.geronimo.system.properties.SystemProperties"> 
     <attribute name="systemProperties">org.apache.geronimo.configs/activemq-ra/2.2.1/car.ActiveMQ\ RA-javax.jms.MessageListener.InstanceLimit=50</attribute> 
    </gbean> 
</module> 

和我工作!因此,我從調試會話中獲得了使用的ID ...現在我們可以設置InstanceLimit = 0,並可以通過ActiveMQ的maxSessions屬性配置並行工作的MDB!