没试过,不知道行不行。
5.7. Configuring Connection Factories
With the default configuration JBoss Messaging binds two connection factories in JNDI at start-up.
The first connection factory is the default non-clustered connection factory and is bound into the following JNDI contexts: /ConnectionFactory, /XAConnectionFactory, java:/ConnectionFactory, java:/XAConnectionFactory.
This connection factory is provided to maintain compatibility with applications originally written against JBoss MQ which has no automatic failover or load balancing.
This connection factory should be used if you do not require client side automatic failover or load balancing.
The second connection factory is the default clustered connection factory and is bound into the following JNDI contexts /ClusteredConnectionFactory, /ClusteredXAConnectionFactory, java:/ClusteredConnectionFactory, java:/ClusteredXAConnectionFactory.
You may want to configure additional connection factories, for instance if you want to provide a default client id for a connection factory, or if you want to bind it in different places in JNDI, if you want different connection factories to use different transports, or if you want to selective enable or disable load-balancing and/or automatic failover for a particular connection factory.
Deploying a new connection factory is equivalent with adding a new ConnectionFactory MBean configuration to connection-factories-service.xml. It is also possible to create an entirely new service deployment descriptor xxx-service.xml altogether and deploy it in $JBOSS_HOME/server/messaging/deploy.
Connection factories can support automatic failover and/or load-balancing by setting the corresponding attributes
An example connection factory configuration is presented below:
<mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory" name="jboss.messaging.connectionfactory:service=MyConnectionFactory" xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml"> <depends optional-attribute-name="ServerPeer"> jboss.messaging:service=ServerPeer </depends> <depends optional-attribute-name="Connector"> jboss.messaging:service=Connector,transport=bisocket </depends> <depends>jboss.messaging:service=PostOffice</depends>
<attribute name="JNDIBindings"> <bindings> <binding>/MyConnectionFactory</binding> <binding>/factories/cf</binding> </bindings> </attribute> <attribute name="ClientID">myClientID</attribute>
<attribute name="SupportsFailover">true</attribute> <attribute name="SupportsLoadBalancing">false</attribute> <attribute name="LoadBalancingFactory">org.acme.MyLoadBalancingFactory</attribute> <attribute name="PrefetchSize">1000</attribute>
<attribute name="SlowConsumers">false</attribute> <attribute name="StrictTck">true</attribute>
<attribute name="DefaultTempQueueFullSize">50000</attribute> <attribute name="DefaultTempQueuePageSize">1000</attribute> <attribute name="DefaultTempQueueDownCacheSize">1000</attribute> <attribute name="DupsOKBatchSize">10000</attribute> </mbean>
The above example would create a connection factory with pre-configured client ID myClientID and bind the connection factory in two places in the JNDI tree: /MyConnectionFactory and /factories/cf.
The connection factory overrides the default values for PreFetchSize, DefaultTempQueueFullSize, DefaultTempQueuePageSize, DefaultTempQueueDownCacheSize and DupsOKBatchSize, SupportsFailover, SupportsLoadBalancing and LoadBalancingFactory.
The connection factory will use the default remoting connector.
To use a different remoting connector with the connection factory change the Connector attribute to specify the service name of the connector you wish to use.
|