|
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<Message>
com.genesyslab.platform.applicationblocks.commons.broker.EventBrokerService
setMessageHandler(handler)
to handle incoming messages asynchronously.
@Deprecated public class EventBrokerService
EventBrokerService
class is designed to work with event/response messages.
[Java]
final String protocolName = "Configuration";
ConfServerProtocol protocol;
EventBrokerService eventBroker;
public void initialize() {
Endpoint endpoint = new Endpoint(
protocolName,
"hostname", 9999);
protocol = new ConfServerProtocol(endpoint);
protocol.setClientApplicationType(CfgAppType.CFGSCE.ordinal());
protocol.setClientName("clientname");
protocol.setUserName("user1");
protocol.setUserPassword("user1-password");
eventBroker = new EventBrokerService(protocol);
eventBroker.activate();
eventBroker.register(
new MyAction(),
new MessageFilter(protocol.getProtocolId())
);
protocol.open();
}
public void deinitialize() {
if (eventBroker != null) {
eventBroker.dispose();
eventBroker = null;
}
if (protocol != null) {
if (protocol.getState() == ChannelState.Opened) {
protocol.close();
}
protocol = null;
}
}
class MyAction implements Action<Message> {
public void handle(final Message msg) {
System.out.println("Incoming message: " + msg);
}
}
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 | |
---|---|
EventBrokerService()
Deprecated. Creates an instance of EventBrokerService class. |
|
EventBrokerService(MessageReceiver<Message> receiver)
Deprecated. Creates an instance of EventBrokerService class. |
Method Summary | |
---|---|
static EventBrokerService |
activate(MessageReceiver<Message> receiver)
Deprecated. |
void |
dispose()
Deprecated. Disposes of the service. |
protected Receiver |
getGenericReceiver()
Deprecated. Gets generic receiver. |
MessageReceiver<Message> |
getReceiver()
Deprecated. |
protected Message |
receive()
Deprecated. Receives event messages. |
void |
setReceiver(MessageReceiver<Message> value)
Deprecated. |
Methods inherited from class com.genesyslab.platform.applicationblocks.commons.broker.MessageBrokerService |
---|
activate, deactivate, 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 EventBrokerService()
EventBrokerService
class.
When using this constructor the following additional steps should be done
to set the service in working state:
setting the invoker - MessageBrokerService.setInvoker(com.genesyslab.platform.commons.threading.AsyncInvoker)
;
setting the receiver - setReceiver(com.genesyslab.platform.commons.protocol.MessageReceiver)
;
calling MessageBrokerService.activate()
method.
public EventBrokerService(MessageReceiver<Message> receiver)
EventBrokerService
class.
receiver
- message receiverMethod Detail |
---|
public static EventBrokerService activate(MessageReceiver<Message> receiver)
public MessageReceiver<Message> getReceiver()
public void setReceiver(MessageReceiver<Message> value)
public void dispose()
MessageBrokerService
dispose
in class MessageBrokerService<Message>
protected Receiver getGenericReceiver()
getGenericReceiver
in class MessageBrokerService<Message>
protected Message receive() throws java.lang.InterruptedException
receive
in class MessageBrokerService<Message>
java.lang.InterruptedException
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |