简体   繁体   中英

how to create workmanager in websphere offline

I have implementation of websocket using workmanager and it is working fine in weblogic.

Below is my web.xml and weblogic.xml

    <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
  <display-name>Archetype Created Web Application</display-name>
  <resource-ref>
    <res-ref-name>test_workmanager</res-ref-name>
    <res-type>commonj.work.WorkManager</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
</web-app>

weblogic.xml

<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">

    <container-descriptor/>

    <charset-params>
        <input-charset>
            <resource-path>/*</resource-path>
            <java-charset-name>UTF-8</java-charset-name>
        </input-charset>
    </charset-params>

    <work-manager>
        <name>test_workmanager</name>
        <ignore-stuck-threads>true</ignore-stuck-threads>
    </work-manager>

    <wl-dispatch-policy>test_workmanager</wl-dispatch-policy>

</weblogic-web-app>

When the weblogic server starts and user logs in then it will create the workmanger and its working fine.

But I wonder if the same behaviour is there in websphere. I know we can create workmanager in websphere admin console. But is it possible to create it offline(like creating websphere.xml) so that once server started it will create the workmanager instead of going to admin console and create it?

You can create a work manager offline using the WebSphere Application Server wsadmin tool, for more information on using wsadmin, start with this IBM KnowledgeCenter topic . To do so, start wsadmin while the server is not running (or using the -conntype NONE parameter), then issue the following command:

AdminConfig.create('WorkManagerInfo', AdminConfig.getid('/Cell:myCell/Node:myNode/Server:server1/WorkManagerProvider:WorkManagerProvider/'), '[[name "test_workmanager"] [workReqQFullAction "0"] [minThreads "0"] [category ""] [defTranClass ""] [daemonTranClass ""] [numAlarmThreads "2"] [workReqQSize "0"] [jndiName "wm/test_workmanager"] [maxThreads "2"] [serviceNames ""] [isGrowable "true"] [threadPriority "5"] [description "test workmanager"] [workTimeout "0"]]')

You will need to subsitute the values for your cell, node and server names in the above. One easy way to get those values is to create a work manager using the Admin Console, then use the Admin Console Command Assistance (on the right side of the console, under the Help section) to show the last command issued. You may copy that command and change the name, jndiName and other attributes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM