In one of our previous posts on weblogic work managers, we explained how to create application scoped work managers in weblogic. As the title of this post suggests, here we will talk about creating global work managers. As explained previously, using Global Work Manager, rules can be configured at the domain level and these rules can then be applied to any application or any application component deployed in the weblogic server.
Similar to application scoped work manager, configuring global work manager is a two step process – first create work manager and then assign it to a component. Work Managers at domain level can be created either by using Weblogic Administration Console or by modifying config.xml file. Let’s understand how to create global work manager from weblogic administration console and then apply it to a module.
Create Work Manager from Weblogic Administration Console
Open weblogic console, expand the node “Environment” in left hand side tree and click on “Work Managers” as shown in the image below [Click on image for better view]:
Click on “New” and it will open a new page with options as shown in the image below:
Let’s first create “Maximum Threads Constraint”. This will help you to understand work manager creation more clearly. Select “Maximum Threads Constraint” and click on Next.
You can either keep the default name or give a more meaningful name. Let’s put “2″ in count which signifies that at any point of time, maximum 2 threads will be assigned to the application to which this work manager is assigned.
Click on Next. On the next screen, select the target for Maximum Threads Constraint from the available targets and click on Finish. This will create a maximum threads constraint “MaxThreadsConstraint-0″ at global level.
Now, go back to Work Manager Summary page by clicking on “Work Managers” in left hand side tree and click on “New” again. This time, select “Work Manager” as shown in the image below:
Click Next and on the next screen, keep the name as default or give one of your own. Click next, select the target for Work Manager from the available targets and click on Finish. Note that “MaxThreadsConstraint-0″ and “WorkManager-0″ both should have same target.
Go to Work Manager Summary page and it should show “MaxThreadsConstraint-0″ and “WorkManager-0″ as shown in the image below.
Thus by following above steps “WorkManager-0″ using “MaxThreadsConstraint-0″ has been created at the domain level. If you open the config.xml now, you can see that below code snippet is added to it:
So you can also add the above code snippet to config.xml straightaway (without performing the steps mentioned above) if you are much aware of the target that you want to specify.
Assign Work Manager to an Application or Module
Now to assign work manager to a specific EJB, weblogic-ejb-jar.xml file needs to be modified as below:
<?xml version='1.0' encoding='UTF-8'?>
For further understanding of work manager and various rules & constraints, refer this.
Hope that you find the information presented here useful. Please feel free to leave your footprints in the comment section below for any queries, feedback or suggestions.