A Message-driven Bean cannot be directly invoked from the producer that is a client application. The producer indirectly invokes a Message-driven Bean by sending a message to the destination.
Typically, a Message-driven Bean does not maintain the status and does not execute the processing in association with a specific client application. Therefore, multiple Message-driven Beans can concurrently parallel-process the sent messages.
- Note
- Multiple messages are parallel-processed by the concurrent execution of multiple Message-driven Bean instances. The order of the processing executed by the Message-driven Bean class instances is not guaranteed.
- If an attempt is made to deliver a large amount of messages to the Message-driven Beans, the RejectedExecutionException exception might occur. When this exception occurs, some of the messages are not delivered to the Message-driven Beans. To avoid this situation, set the maximum number of thread pools to at least the number of Message-driven Bean instances, as the runtime attribute of the CJMSP resource adapter.
- The sending of the messages might be delayed due to the restriction on the number of concurrently executed instances specified for the Message-driven Beans. To prevent this problem, specify a value of the number of Message-driven Bean instances or more as the number of threads executed with the CJMSP resource adapters.
Also, the number of Message-driven Bean endpoints becomes the number of messages that can be processed in parallel. To prevent problems occurring due to the restrictions on the number of endpoints, specify a value of the number of Message-driven Bean instances or more as the number of endpoints. The expression is as follows:
Total-number-of-Message-driven-Bean-instances <= number-of-Work-threads-of-the-CJMSP-resource-adapter
number-of-Message-driven-Bean-instances >= number-of-endpoint-instances |
Note that you define the number of Message-driven Bean instances in cosminexus.xml or the MessageDrivenBean property file. Define the number of Message-driven Bean endpoints in the DD. Define the number of CJMSP resource adapter threads in the HITACHI Connector Property file.
For details on cosminexus.xml, see 2. Cosminexus Application Property File (cosminexus.xml) in the uCosminexus Application Server Application and Resource Definition Reference Guide. For details on the MessageDrivenBean property file, see 3.6 MessageDrivenBean property file in the uCosminexus Application Server Application and Resource Definition Reference Guide. For details on the HITACHI Connector Property file, see 4.1 HITACHI Connector Property file in the uCosminexus Application Server Application and Resource Definition Reference Guide.
- If you use CJMS Provider to deliver messages to Message-driven Beans, and stop CJMSP Broker while the messages are being delivered, the messages are not delivered even if you restart CJMSP Broker. If you stop CJMSP Broker, restart the J2EE server.