|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.applicationblocks.commons.broker.BrokerServiceBase<T>
com.genesyslab.platform.applicationblocks.commons.broker.MessageBrokerService<RequestContext>
com.genesyslab.platform.applicationblocks.commons.broker.RequestBrokerService
setMessageHandler(handler)
to handle incoming messages asynchronously.
@Deprecated public class RequestBrokerService
RequestBrokerService
class is designed to work with request messages.
[Java]
private ExternalServiceProtocolListener requestListener = null;
private RequestBrokerService requestBroker = null;
public void initialize() {
this.requestListener = new ExternalServiceProtocolListener(
new Endpoint("MyESPServer", "localhost", 9999));
this.requestBroker = new RequestBrokerService(requestListener);
this.requestBroker.activate();
this.requestBroker.register(new RequestHandle(), null);
this.requestListener.open();
}
public void deinitialize() {
if (this.requestBroker != null) {
this.requestBroker.dispose();
this.requestBroker = null;
}
if (this.requestListener != null) {
if (this.requestListener.getState() == ChannelState.Opened) {
this.requestListener.close();
}
this.requestListener = null;
}
}
class RequestHandle implements Action<RequestContext> {
public void handle(final RequestContext context) {
Message request = context.getRequestMessage();
// ...
Message response = EventSomeResponse.create(
"Operation result");
context.respond(response);
}
}
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.genesyslab.platform.applicationblocks.commons.broker.MessageBrokerService |
---|
MessageBrokerService.LifecycleStage |
Field Summary |
---|
Fields inherited from class com.genesyslab.platform.applicationblocks.commons.broker.MessageBrokerService |
---|
lifecycleLock, status |
Constructor Summary | |
---|---|
RequestBrokerService()
Deprecated. Creates an instance of RequestBrokerService class. |
|
RequestBrokerService(RequestReceiver theReceiver)
Deprecated. Creates an instance of RequestBrokerService class. |
Method Summary | |
---|---|
protected Receiver |
getGenericReceiver()
Deprecated. Gets generic receiver. |
RequestReceiver |
getReceiver()
Deprecated. Gets request receiver. |
protected RequestContext |
receive()
Deprecated. Receives request messages. |
void |
setReceiver(RequestReceiver value)
Deprecated. Sets request receiver. |
Methods inherited from class com.genesyslab.platform.applicationblocks.commons.broker.MessageBrokerService |
---|
activate, deactivate, dispose, getInvoker, isActive, setInvoker |
Methods inherited from class com.genesyslab.platform.applicationblocks.commons.broker.BrokerServiceBase |
---|
notify, onNotificationException, onPublish, publish, register, register, switchSubscribersList, unregister, unregister, unregisterAll |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestBrokerService()
RequestBrokerService
class.
When using this constructor the following additional steps
should be done to set the service in working state:
setting the invoker - property Invoker
;
setting the receiver - property Receiver
;
calling Activation
method.
public RequestBrokerService(RequestReceiver theReceiver)
RequestBrokerService
class.
theReceiver
- Initializes request receiverMethod Detail |
---|
public RequestReceiver getReceiver()
public void setReceiver(RequestReceiver value)
value
- request receiverprotected RequestContext receive() throws java.lang.InterruptedException
receive
in class MessageBrokerService<RequestContext>
java.lang.InterruptedException
protected Receiver getGenericReceiver()
getGenericReceiver
in class MessageBrokerService<RequestContext>
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |