The following are the conventions to use for developing JBI components and the associated service unit managers.
The intended behavior was clarified with Ron Ten-Hove and Peter Walker; we then added guidelines as to how this behavior should be achieved.
Note that one of the most misleading states is the SU "stopped" state; SU stopped really should be called "stop consuming" as it still is suppoed to provision in this state - unlike BC/SE stop where it has to stop consuming AND provisioning.
Some components still have to be corrected to follow SU stop/shutdown conventions correctly. Without following these conventions there can be race conditions that lead to loss of messages at start-up and shut-down under normal operating conditions.
Implementation guidelines for the state transition methods
- Init: start provisioning
Register endpoints with NMR, if receive/accept loop from NMR is enabled (component is started) process messages from the NMR and BCs service outbound external connections, SEs execute business logic, but "pause" when it reaches an invoke.
- Start: start consuming
SEs: handle invokes, “continue” business logic that was paused before an invoke, BCs: Start inbound external connections (or at least servicing them) and process requests
- Stop: stop consuming
SEs “pause” executing business logic when it reaches an invoke, BCs: Stop inbound external connections (or don’t service them)
- Shutdown: stop provisioning
Unregister endpoints with NMR, SEs stop processing business logic, BCs stop outbound external connections (or don't service them)
- Init: prepare for execution
- Start: enable the receive/accpet loop(s) from the NMR – rely on the SU starts to start consuming (see assumptions)
- Stop: disable the receive/accept loop(s) from the NMR – rely on the SU stops to stop consuming as well (see assumptions)
- Shutdown: cleanup/release resources
The above relies on the behavior of the RI / OpenESB to call SU lifecycle methods when the component ones get called; this behavior is not explicitly declared in the spec.
Certain issues are not spelled out in these conventions. These issues were discussed in a meeting, the notes for which can be found here