2016-07-28 73 views
1

我們在wildfly10的standalone-full.xml中有以下配置。如何通過wildfly限制ejb mdb(messsage驅動的bean)實例10 standalone-full.xml

<subsystem xmlns="urn:jboss:domain:ejb3:4.0"> 
      <session-bean> 
       <stateless> 
        <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/> 
       </stateless> 
       <stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/> 
       <singleton default-access-timeout="5000"/> 
      </session-bean> 
      <mdb> 
       <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/> 
       <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/> 
      </mdb> 
      <pools> 
       <bean-instance-pools> 
        <strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/> 
        <strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/> 
        <strict-max-pool name="ExchangeMessagePool" max-pool-size="10" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/> 
        </bean-instance-pools> 
      </pools> 
      </subsystem> 

我們有與交換消息pool.In獨立-full.xml我們已經設置了最大池大小爲10,但實例的數量鏈接下面的消息驅動Bean的服務器中得到創建startup是30,但我不知道它來自哪裏。是否有任何方法可以限制這一點。如果有任何方法來限制在獨立完整文件中訪問此bean的併發線程數。

@MessageDriven(name = "ExchangeMessage", activationConfig = {@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/ExchangeMessageQueue")}) 
@PermitAll 
@Pool("ExchangeMessagePool") 
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) 
@TransactionManagement(TransactionManagementType.CONTAINER) 
public class ExchangeMessageBean implements MessageListener 
{ 
... 
} 
+0

[如何配置Wildfly以提供靜態內容(如圖像)?](http://stackoverflow.com/questions/22684037/how-to-configure-wildfly-to-serve-static-content-像圖像) –

+0

你有沒有想過如何做到這一點?我也嘗試在[此線程](http://stackoverflow.com/q/40806160/3231778)中使用類似的方案 – BonanzaOne

回答

0

如果不指定@ResourceAdapter它使用默認池連接工廠命名爲「ActiveMQ的-RA」,它有它自己的默認,要麼使用其默認(我認爲這是爲15)除了指定的池,或者兩者都有。您可以使用maxSessions =「n」註釋MDB,並將並行實例的數量限制爲n。