BibleGateway.com Verse Of The Day


“But he was pierced for our transgressions, he was crushed for our iniquities; the punishment that brought us peace was on him, and by his wounds we are healed. We all, like sheep, have gone astray, each of us has turned to our own way; and the LORD has laid on him the iniquity of us all.” (Isaiah 53:5-6)  listen to chapter  (Read by Max McLean. Provided by The Listener's Audio Bible.)

Powered by BibleGateway.com

Friday, December 03, 2010

WebLogic Annotation For MDB WorkManager

If you are like me, you have been searching the web for 2 hours looking for a way to tie your WebLogic 10g message-driven bean to a WLS WorkManager using the nice EJB3 annotations. But since you aren't me, let me save you some time.

It ain't there. Not gonna do it. Not happening for you today, my friend.

You have to do a bastardized mutt application using a combo of annotations and XML deployment descriptors (remember those?).

Allow me to save you more time by showing a more concise example, so you don't have to take a time machine back to a time when EJB2.1 and XML roamed together in dinosaur-like bliss and figure out what the descriptor should look like.

Here's an example:

My MDB class signature looks something like this....

@MessageDriven(activationConfig = {
@ActivationConfigProperty(
propertyName = "destinationType",
propertyValue = "javax.jms.Queue") },
mappedName = "jms.ens.yes943processing.queue")
public class YearEndProcessingMdb implements MessageListener {
...


And so on, with your onMessage() and all the other crap you would put in an MDB.
Then my weblogic-ejb-jar.xml file looks a bit like this....

<wls:weblogic-enterprise-bean>
<wls:ejb-name>YearEndProcessingMdb</wls:ejb-name>
<wls:dispatch-policy>Ens943WorkMgr</wls:dispatch-policy>
</wls:weblogic-enterprise-bean>

<wls:work-manager>
<wls:name>Ens943WorkMgr</wls:name>
<wls:max-threads-constraint>
<wls:name>Ens943MaxThreadLimiter</wls:name>
<wls:count>10</wls:count>
</wls:max-threads-constraint>
<wls:ignore-stuck-threads>true</wls:ignore-stuck-threads>
</wls:work-manager>
</wls:weblogic-ejb-jar>



You can tell if the thread limiter is working by deploying, chucking a bunch of messages on thequeue, and checking the WLS console.

  • Go to deployments
  • Click to expand your EAR
  • Click on the MDB name.
  • Then go to the Monitoring tab.
  • Under that click on the Workload tab.
  • Here you should see your work manager and thread constraints with the number of messages they are processing.

1 comment:

Anonymous said...

Awesome! Thanks! It did save me time... but how would they not provide this configuration through annotations is crazy... :S