Websphere Liberty 8.5" com_ibm_ws_batch_partitionNum"不管用

时间:2016-06-07 14:08:51

标签: websphere-liberty

我在Websphere Liberty 8.5中配置了embeddedJMS。 它是Dispatcher - Executor Setup。

我正在尝试配置" com_ibm_ws_batch_partitionNum" messageSelector中的属性,但是当我配置此属性时,作业没有执行.. 下面是我在执行程序中配置的代码

<jmsActivationSpec id="batchActivationSpec" maxEndpoints="5">
<properties.wasJms destinationRef="batchJobSubmissionQueue"   destinationType="javax.jms.Queue" maxBatchSize="5" maxConcurrency="5" messageSelector="com_ibm_ws_batch_applicationName = 'LibertyBatchPOC' AND com_ibm_ws_batch_partitionNum = 1" remoteServerAddress="localhost:7280:BootstrapBasicMessaging">
    </properties.wasJms>
</jmsActivationSpec>

如下所示完成Executor1 Server.xml,Executor2也与不同的端口相同,并且com_ibm_ws_batch_partitionNum配置为&#34; 2&#34;

  <server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>wasJmsClient-2.0</feature>
        <feature>batchManagement-1.0</feature>
        <feature>batch-1.0</feature>
        <feature>javaMail-1.5</feature>
        <feature>batchManagement-1.0</feature>
        <feature>jdbc-4.1</feature>
        <feature>jndi-1.0</feature>
        <feature>localConnector-1.0</feature>
        <feature>jaxb-2.2</feature>
    </featureManager>

    <!-- To access this server from a remote client add a host attribute to 
        the following element, e.g. host="*" -->
    <httpEndpoint httpPort="9082" httpsPort="9445" id="defaultHttpEndpoint"/>

    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true"/>
<!---DB2 database setup-->
<library id="DB2Lib">
        <fileset dir="${shared.resource.dir}" includes="*.jar"/>
    </library>
    <dataSource id="testDB" jndiName="jdbc/test" transactional="false">
        <jdbcDriver libraryRef="DB2Lib"/>
        <properties.db2.jcc currentSchema="TestSchema" databaseName="DB2C" password="password" portNumber="5002" serverName="aa.test.com" user="TestDB"/>
    </dataSource>
    <!-- Database setup for DERBY -->
    <!-- Database setup for DERBY Network DB -->
    <!-- Batch persistence config. References a databaseStore. -->
    <batchPersistence jobStoreRef="BatchDatabaseStore"/>

    <!-- The database store for the batch tables. -->
    <!-- Note this database store is referenced by the batchPersistence element. -->
    <databaseStore createTables="true" dataSourceRef="batchDB" id="BatchDatabaseStore" schema="JBATCH" tablePrefix=""/>

    <!-- Derby JDBC driver -->
    <!-- Note this library is referenced by the dataSource element -->

    <library id="DerbyLib">
        <fileset dir="${shared.resource.dir}/derby/lib" includes="derbyclient.jar"/>
    </library>
<!-- Data source for the batch tables. -->
<!-- Note this data source is referenced by databaseStore element -->
<dataSource id="batchDB" jndiName="jdbc/batch" type="javax.sql.XADataSource">
<jdbcDriver libraryRef="DerbyLib"/>
<properties.derby.client createDatabase="create" databaseName="${shared.resource.dir}/databases/BATCHDB" password="pass" portNumber="1527" serverName="localhost" user="user"/>

    </dataSource>

    <jdbcDriver id="derbyDriver" javax.sql.ConnectionPoolDataSource="org.apache.derby.jdbc.ClientConnectionPoolDataSource" javax.sql.XADataSource="org.apache.derby.jdbc.ClientXADataSource" libraryRef="DerbyLib"/>

    <!-- Authorization and Security -->
    <keyStore id="defaultKeyStore" password="Liberty"/>

    <basicRegistry id="basic" realm="ibm/api">
        <user name="bob" password="bobpwd"/>
        <user name="jane" password="janepwd"/>
    </basicRegistry>

    <authorization-roles id="com.ibm.ws.batch">
        <security-role name="batchAdmin">
            <user name="bob"/>
        </security-role>
    </authorization-roles>

    <batchJmsExecutor activationSpecRef="batchActivationSpec" queueRef="batchJobSubmissionQueue"/>

    <!-- note that message selector need space around the equal sign -->
    <jmsActivationSpec id="batchActivationSpec" maxEndpoints="5">
        <properties.wasJms destinationRef="batchJobSubmissionQueue" destinationType="javax.jms.Queue" maxBatchSize="5" maxConcurrency="5" messageSelector="com_ibm_ws_batch_applicationName = 'LibertyBatchPOC' AND com_ibm_ws_batch_partitionNum=1" remoteServerAddress="localhost:7280:BootstrapBasicMessaging">
        </properties.wasJms>
    </jmsActivationSpec>

    <jmsQueue id="batchJobSubmissionQueue" jndiName="jms/batch/jobSubmissionQueue">
        <properties.wasJms deliveryMode="Persistent" queueName="batchLibertyQueue" readAhead="AsConnection" timeToLive="0"/>
    </jmsQueue>
<logging maxFileSize="200" maxFiles="10" traceFileName="trace.log" traceSpecification="com.ibm.jbatch.*=all:com.ibm.ws.jbatch.*=all"/>
   <applicationMonitor updateTrigger="mbean"/>
</server>

Dispatcher Server.xml

    <?xml version="1.0" encoding="UTF-8"?>
<server description="BatchDispatcher">

    <!-- BATCH DISPATCHER -->

    <!-- Enabled features -->
    <featureManager>
        <feature>wasJmsClient-2.0</feature>
        <feature>batchManagement-1.0</feature>
    </featureManager>

    <!-- JMS Configuration -->
    <batchJmsDispatcher connectionFactoryRef="batchConnectionFactory"
        queueRef="batchJobSubmissionQueue" />
<batchJmsEvents connectionFactoryRef="batchConnectionFactory" />
    <jmsConnectionFactory id="batchConnectionFactory"
        jndiName="jms/batch/connectionFactory">
        <properties.wasJms remoteServerAddress="localhost:7280:BootstrapBasicMessaging" />
    </jmsConnectionFactory>

    <jmsQueue id="batchJobSubmissionQueue" jndiName="jms/batch/jobSubmissionQueue">
        <properties.wasJms deliveryMode="Persistent"
            queueName="batchLibertyQueue" readAhead="AsConnection" timeToLive="0"></properties.wasJms>
    </jmsQueue>
    <!-- Server HTTP port setup -->
    <httpEndpoint id="defaultHttpEndpoint" httpPort="9081"
        httpsPort="9444" />

    <!-- Database setup for DERBY -->
    <!-- Database setup for DERBY Network DB -->
    <!-- Batch persistence config. References a databaseStore. -->
    <batchPersistence jobStoreRef="BatchDatabaseStore" />

    <!-- The database store for the batch tables. -->
    <!-- Note this database store is referenced by the batchPersistence element. -->
    <databaseStore id="BatchDatabaseStore" createTables="true"
        dataSourceRef="batchDB" schema="JBATCH" tablePrefix="" />

    <!-- Derby JDBC driver -->
    <!-- Note this library is referenced by the dataSource element -->

    <library id="DerbyLib">
        <fileset dir="${shared.resource.dir}/derby/lib" includes="derbyclient.jar" />
    </library>

    <!-- Data source for the batch tables. -->
    <!-- Note this data source is referenced by databaseStore element -->
    <dataSource id="batchDB" jndiName="jdbc/batch" type="javax.sql.XADataSource">
        <jdbcDriver libraryRef="DerbyLib" />
        <properties.derby.client createDatabase="create"
            databaseName="${shared.resource.dir}/databases/BATCHDB" serverName="localhost"
            portNumber="1527" user="user" password="pass" />

    </dataSource>

    <jdbcDriver id="derbyDriver"
        javax.sql.ConnectionPoolDataSource="org.apache.derby.jdbc.ClientConnectionPoolDataSource"
        javax.sql.XADataSource="org.apache.derby.jdbc.ClientXADataSource"
        libraryRef="DerbyLib" />

    <!-- Authorization and Security -->
    <keyStore id="defaultKeyStore" password="Liberty"/>

    <basicRegistry id="basic" realm="ibm/api">
        <user name="bob" password="bobpwd" />
        <!--<user name="jane" password="janepwd" />-->
    </basicRegistry>

    <authorization-roles id="com.ibm.ws.batch">
        <security-role name="batchAdmin">
            <user name="bob" />
        </security-role>
    </authorization-roles>

    <!-- Enable Batch tracing for troubleshooting purposes -->
    <logging maxFileSize="200" maxFiles="10"
        traceSpecification="com.ibm.jbatch.*=all:com.ibm.ws.jbatch.*=all"
        traceFileName="trace.log" />

</server>

2 个答案:

答案 0 :(得分:1)

如果那些是你唯一的两个执行者,那么工作本身就不会运行,因为没有选择器来获得这份工作。您有一个执行程序来运行分区1和一个执行程序来运行分区2,但没有执行程序只运行实际的作业。您可以调整执行程序1以允许分区num值为1或NULL(不为作业本身设置),然后作业AND分区1将在执行程序1上运行。
请注意,您需要小心这一点..如果您绑定运行实际作业的服务器,则没有剩余空间来运行分区,它将挂起。

答案 1 :(得分:0)

你需要两件事。

1)您需要有一个执行程序,它将首先运行该作业,并将分区排队以供其他执行程序使用

为此,您需要在消息选择器中没有其他属性。或者,您可以使用值为com_ibm_ws_batch_work_type的属性JobPartition来根据类型选择和执行工作。

请注意,要通过多个执行程序从作业分发分区,您需要在运行顶级作业的执行程序中配置<batchJmsDispatcher>元素。

2)需要的第二件事是运行分区的执行程序,您可以在其中使用问题中描述的消息选择器(wi