0 Replies Latest reply on Nov 26, 2007 10:06 AM by David Lloyd

    Contexts, Sessions and Services

    David Lloyd Master

      Contexts have been refactored to be generic. The type signature is "Context<I, O>" where I is the request ("input") type and O is the reply ("output") type. Unfortunately both request and reply start with "R". :-)

      Anyway, Request and Reply are both generic now as well. This means that no casting is needed to get the message body from either of these types.

      In order to facilitate this change, I've abolished the notion of ListenerMappers where every request has an identifier and a body. Instead, each request just consists of a body, and the user can easily build that functionality on if they so desire. This also helps simplify the overall API, and make it more familiar to users of the Remoting 2 API.

      I've also formalized the notion of a "service", which basically means a named RequestListener that is deployed on an Endpoint. A service is specified by creating a org.jboss.cx.remoting.ServiceLocator, which specifies the name of the service, and the request and reply types, as well as a few other parameters.

      Providing a ServiceLocator to Session.openService() returns a ContextSource which can be used to open channels to the service (Context instances).

      A ServiceLocator may also be used directly on an Endpoint to access dynamically discovered services - though the mechanism to actually perform the discovery is an M2 task.