Petals-SE-RMI 1.6.x

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (1)

View Page History
{info}All objects handle in the code lines presented in the next sections are instantiated from all classes included in the jar artefact of the RMI component.{info}

h2. Getting the remote component context and activate/desactivate endpoints

The code lines presented below allows a client to access to the remote component context, to activate and desactivate an endpoint:
{code:java}
// Access to the remote component context from the ComponentContextLocator
RemoteComponentContext rcc = ccl.getComponentContext();

// Activation of an endpoint
ServiceEndpoint endpoint = rcc.activateEndpoint(new QName("http://petals.objectweb.org/", “RmiService”), “RmiEndpoint”);

// Desactivation of the endpoint
rcc.deactivateEndpoint(endpoint);
{code}

h2. Getting the remote message exchange factory and create different kind of messages

The code lines presented below allows a client to access to the remote message exchange factory and create different kind of messages:
{code:java}
// Access to the remote message exchange factory from remote component context
RemoteMessageExchangeFactory rmef = rcc.getDeliveryChannel().createExchangeFactory();

// create an in only message exchange
MessageExchange msgInOnly = rmef.createInOnlyExchange();

// create an in out message exchange
MessageExchange msgInOut = rmef.createInOutExchange();

// create an in optional out message exchange
MessageExchange msgOptionalOut = rmef.createInOptionalOutExchange();

// create an robust in only message exchange
MessageExchange msgRobustInOnly = rmef.createRobustInOnlyExchange();
{code}

h2. Getting the remote delivery channel and send/accept JBI messages

The following code snippet allows a client to access to the remote delivery channel:
{code:java}
// Access to the remote delivery channel from remote component context
RemoteDeliveryChannel rdc = rcc.getDeliveryChannel();

The following code snippet shows an asynchronous message exchange between the client and a provider:

// Send a asynchronous message
rdc.send(msgInOnly);

// Accept the response of provider
MessageExchange msgResponseInOnly = rdc.accept();

The following code snippet shows an synchronous message exchange between the client and a provider:

// Send a synchronous message
msgInOut = rdc.sendSync(msgInOut);

if(msgInOut != null) {
// Change the status
msgInOut.setStatus(ExchangeStatus.DONE);

// Terminate the exchange
rdc.send(msgInOut);
}
{code}

{note}The method '{{sendSync}}' is not JBI compliant. It is different of JBI interface because the message exchange in input parameter is not a remote object. So, it cannot be set in the method.{note}

h1. Installation