如何将TomEE中的@Ressource添加到Jboss

时间:2016-03-17 09:02:35

标签: java xml jboss activemq tomee

我正在尝试将应用程序从TomEE迁移到Jboss。

我发现了一些注入Ressource:

@Resource(name = "SaraConnectionFactory")
private ConnectionFactory saraConnectionFactory;

@Resource(name = "SaraToOlsQueue")
private Queue saraQueue;

@Resource(name = "SaraTargetService")
private String service;

@Resource(name = "SaraTimeout")
private long timeout;

该语句在TomEE.xml中,如下所示:

    <Resource id="SaraJMSResourceAdapter" type="ActiveMQResourceAdapter">
    <!--BrokerXmlConfig -->
    ServerUrl tcp://bdv06:61616
     </Resource>

    <Resource id="SaraToOlsQueue" type="javax.jms.Queue">
    destination RMW
    </Resource>

    <Connector id="SaraConnectionFactory"type="javax.jms.ConnectionFactory">
    ResourceAdapter SaraJMSResourceAdapter

    # Specifies if the connection is enrolled in global transaction
    TransactionSupport none

    # Maximum number of physical connection to the ActiveMQ broker
    PoolMaxSize 10

    # Minimum number of physical connection to the ActiveMQ broker
    PoolMinSize 0

    # Maximum amount of time to wait for a connection
    ConnectionMaxWaitMilliseconds 10000

    # Maximum amount of time a connection can be idle before being reclaimed
    ConnectionMaxIdleMinutes 15
    </Connector>

如何将这些标记转换为standalone.xml(Jboss)。

Thxs。

1 个答案:

答案 0 :(得分:0)

我试着用这种方法将activeMQ模拟成JBOSS。

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
        <resource-adapters>
            <resource-adapter id="resourceAdapterForSara">
                <module slot="main" id="org.apache.activemq"/>
                <transaction-support>XATransaction</transaction-support>
                <config-property name="ServerUrl">
                    tcp://cdjactivemq:3030
                </config-property>
                <connection-definitions>
                    <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:jboss/connectionFactoryForSara" enabled="true" use-java-context="true" pool-name="connectionFactoryForSara">
                        <xa-pool>
                            <min-pool-size>1</min-pool-size>
                            <max-pool-size>20</max-pool-size>
                        </xa-pool>
                        <recovery>
                            <recover-credential>
                                <user-name>admin</user-name>
                                <password>admin</password>
                            </recover-credential>
                        </recovery>
                    </connection-definition>
                </connection-definitions>
            </resource-adapter>
        </resource-adapters>
    </subsystem>