0

I have created an MDB to act as a simulator which reads a message from a queue and then write a response to a different queue. To control this simulator i defined some public static methods in the MDB to stop reading/writing and to know if it's active or not.

I don't know if this is wrong since i didn't suffer from any problems yet. However, I can't find a good way to programmatically control the MDB.

Any ideas?

1 Answers1

0

Using static methods in simulator is a simple, yet not too clear way. I think that probably better solution is to control your state using JMX.

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • do you have any resource cover embedding jmx in ear application? –  Apr 27 '14 at 11:18
  • JMX is supported by JVM since Java 1.5. You do not have to embed anything. Just expose your MDB as MBean. – AlexR Apr 27 '14 at 11:21
  • Thx...But my concern is about consistency of the MDB in a clustered environment. does JMX handle synchronization in clustered environment?? does it manage all instances of the MDB or it will cause troubles?? –  Apr 27 '14 at 11:26
  • No, you have to implement it yourself. Exactly as in case of static methods. But why do you need cluster-wide implementation for a simple simulator? Do you really need it? If yes, please explain your requirements again clearly. – AlexR Apr 27 '14 at 12:13