RM SENDER AND RECEIVER LOCATION WITHIN JBOSSWS STACK RM Sender and Receiver must operate on top of the transport layer so they are able to create and close new transport connections. RM Sender and Receiver are RM entities which goal is to ensure message delivery and reliability according to the specified RM policy. The expected model of RM sender/receiver is: * It will be a separate thread responsible for accepting/returning messages from/to JBossWS messaging layer * It will persist all messages going through it * It will query messages in the RM store against specific conditions * It will create RM tasks and put it to the RM task queue when re/send is necessary Picture of the client side follows (RM RECEIVER is similar): +-----------------------------------------------------------------------------------+ | RM CHANNEL | +---+ | | | | | +-----------+ +---------+ | | J | send(request) | | put(RM request) | | | | B |------------------->| |------------------->| RM | | | O | | | RM SENDER | | TASKS | | | S | return response | | return RM response | QUEUE | | | S |<-------------------| |<---------+ | | | | W | | +-----------+ | +---------+ | | S | | | A | | | | | | | | +----------+ | | | M | | | | | | | | E | | write(request) | query | read(request) | | | | S | | write(response) | | read(resposne) | | take RM task | | S | | | | | | | | A | | V | | | | | G | | +-----------+ +---|------|------------------------+ | | I | | | | | | | RM THREAD POOL | | | N | | | RM STORE | | | V | | | G | | | | | +----------+ +----------+ | | | | | +-----------+ | | Thread 1 | ... | Thread N | | | | L | | | +----------+ +----------+ | | | A | | | A | | | | Y | | +---|------|------------------------+ | | E | | | | | | R | | read(response)| | write(request) | | | | | | | +---+ | +----|------|------------------------+ | | | | V | | +---+ | | | +-----------------------+ | | | | | | | | Output Stream |-------->| N | | | | +-----------------------+ | | | E | | | | | | | T | | | | REMOTING TRANSPORT | | | W | | | | | | | O | | | +---------------------+ | | | R | | | | Input Stream |<-----------------| K | | | +---------------------+ | | | | | | | | +---+ | +------------------------------------+ | | | +-----------------------------------------------------------------------------------+ Definitions: NETWORK - Intranet or Internet network JBOSSWS MESSAGING LAYER - JBossWS messaging layer RM CHANNEL - is responsible for message acceptance from the JBOSSWS MESSAGING LAYER. Since this time this channel is responsible for reliable message delivery and will comunicate with JBOSSWS MESSAGING LAYER accordingly (i.e. ensuring message in order delivery etc ...) RM STORE - is responsible for persistent operations. It must be able to: * write message and its associated metadata, * read the message and its associated metadata, * query the messages in the store according to the specified criteria NOTE 1: Messages and their metadata must be fully de/serializable without dependency on the context class loader. That means all messages will be de/serialized before putting them to the RM STORE. NOTE 2: Messages and their metadata will be de/serialized in the same thread that initiated the invocation because of the heavy use of ThreadLocals in the JBossWS invocation framework. (However this requirement could be fixed by removing the ThreadLocal dependency) RM TASKS QUEUE - holds RM tasks identified by the RM SENDER/RECEIVER that have to be send to the transport layer RM THREAD POOL - holds RM threads that are responsible for doing the tasks stored in the RM TASKS QUEUE and execute them against REMOTING TRANSPORT NOTE: All this is about messages acceptance from the JBossWS messaging layer and ensuring the reliable delivery to the network and than back to the mesaging layer. It is not about the RM message creation on the SOAP layer. SOAP headers related to the WS-RM specification will be handled on higher level. IMPLEMENTATION LOCATION: I decided that the most suitable place to put RM CHANNEL to is the RemotingConnectionImpl class.