当前位置: 首页 > 知识库问答 >
问题:

Websphere Liberty 8.5“com_ibm_ws_batch_partitionNum”不工作

郎磊
2023-03-14

我已经在Websphere Liberty 8.5中配置了嵌入式JMS。它是Dispatcher-Executor Setup。

我正在尝试在消息选择器中配置“com_ibm_ws_batch_partitionNum”属性,但是当我配置此属性时,作业未执行。以下是我在执行器中配置的代码

<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配置为“2”

  <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个答案

郗俊能
2023-03-14

你需要两样东西。

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

为此,消息选择器中不需要其他属性。或者,可以使用具有值“作业”或“分区”的属性com_ibm_ws_batch_work_type根据类型选择和执行工作。

请注意,要将作业中的分区分布到多个执行程序上,您需要配置

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

陈铭晨
2023-03-14

如果只有这两个执行器,那么作业本身就不会运行,因为没有选择器来获取作业。您有一个执行器来运行分区1,一个执行程序来运行分区2,但没有一个只运行实际作业的执行器。您可以调整executor 1以允许分区num值为1或NULL(未为作业本身设置),然后作业and分区1将在executor 2上运行。
请注意,如果您将运行实际作业的服务器捆绑在一起,则可能没有空间运行分区,它将挂起。

 类似资料:
  • 我想在菜单栏文本被选中时更改它的颜色。 这里可能出了什么问题? 我尝试使用伪类':active',但没有得到应用。其中as':Hover'正在工作。 我还尝试使用'Router LinkActive',它应该添加类'Active-Link',但这也不起作用。 我在下面给出了HTML、SCCS和TS代码:

  • 我编写了一组简单的类,向一位朋友演示如何为AOP(而不是xml配置)使用注释。我们无法使@ComponentScan工作,并且AnnotationConfigApplicationContext getBean的行为也不正常。我想明白两件事。请参阅下面的代码: PersonOperationSI.java PersonOperations.java PersonOperationsConfigCl

  • 我正在Eclipse Neon中使用Hibernate工具(JBoss tools 4.4.0.Final)。现在,我想将数据库表反向工程为POJO对象和Hibernate映射文件。 我遵循了一些关于如何设置Eclipse来生成POJO对象的教程。在我运行配置之前,一切看起来都很好。什么都没发生,也没有抛出错误。有人能帮我吗?数据库是一个微软SQL服务器2014。 我的逆向工程配置文件看起来像:

  • 我正在尝试使用codeigniter insert\u batch将多行插入到我的数据库表中。根据错误报告,似乎没有设置表列。只是阵列的数量: 我的看法是: 我的控制器: 和型号:

  • 我尝试使用StreamWriter.WriteLine(不是静态地)将几行代码一次写到。txt文件中。 每个播放器对象都是字符串cosnatants。如果我使用不同的文件名(也称为BasicTestInfo2.txt),它会在bin.debug中创建该文件,但它是空的。我知道我到达了using块的内部(我在里面放了一个console.writeline),我知道我想要截断,这就是为什么我对appe