|
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.AsyncBrokerServiceBase<Message>
com.genesyslab.platform.applicationblocks.commons.broker.EventReceivingBrokerService
setMessageHandler(handler)
to handle incoming messages asynchronously.
@Deprecated public class EventReceivingBrokerService
EventReceivingBrokerService
class is designed to work with event/response messages.
[Java]
final String protocolName = "Configuration";
ConfServerProtocol protocol;
EventReceivingBrokerService 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 EventReceivingBrokerService(
new SingleThreadInvoker("EventReceivingBrokerService-1"));
protocol.setMessageHandler(eventBroker);
eventBroker.register(
new MyAction(),
new MessageFilter(protocol.getProtocolId())
);
}
class MyAction implements Action<Message> {
public void handle(final Message msg) {
System.out.println("Incoming message: " + msg);
}
}
[Java]
...
statProtocol.setMessageHandler(eventBroker);
ixnProtocol.setMessageHandler(eventBroker);
routingProtocol.setMessageHandler(eventBroker);
// register handler for the stat protocol messages:
eventBroker.register(
new MyStatAction(),
new MessageFilter(statProtocol.getProtocolId())
);
// register handler for all of the protocols messages:
eventBroker.register(
new MyAction(), null);
...
eventBroker
will handle all incoming messages from all initialized
protocols one by one, using its invoker.
MessageHandler
,
ClientChannel.setMessageHandler(MessageHandler)
Field Summary |
---|
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver |
---|
DEF_INPUT_SIZE |
Constructor Summary | |
---|---|
EventReceivingBrokerService()
Deprecated. Creates an instance of EventReceivingBrokerService class. |
|
EventReceivingBrokerService(AsyncInvoker invoker)
Deprecated. Creates an instance of EventReceivingBrokerService class. |
Method Summary | |
---|---|
void |
clearInput()
Deprecated. this interface is going to be removed from this class |
int |
getInputSize()
Deprecated. this interface is going to be removed from this class |
void |
onChannelClosed(ChannelClosedEvent event)
Deprecated. this interface is going to be removed from this class |
void |
onChannelError(ChannelErrorEvent event)
Deprecated. this interface is going to be removed from this class |
void |
onChannelOpened(java.util.EventObject event)
Deprecated. this interface is going to be removed from this class |
void |
onMessage(Message message)
Deprecated. Enqueues message for publishing by the invoker. |
void |
processMessage(Message message)
Deprecated. this interface is going to be removed from this class |
Message |
receive()
Deprecated. this interface is going to be removed from this class |
Message |
receive(long arg0)
Deprecated. this interface is going to be removed from this class |
void |
releaseReceivers()
Deprecated. this interface is going to be removed from this class |
void |
setInputSize(int arg0)
Deprecated. this interface is going to be removed from this class |
Methods inherited from class com.genesyslab.platform.applicationblocks.commons.broker.AsyncBrokerServiceBase |
---|
publish, setInvoker |
Methods inherited from class com.genesyslab.platform.applicationblocks.commons.broker.BrokerServiceBase |
---|
notify, onNotificationException, onPublish, 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 EventReceivingBrokerService()
EventReceivingBrokerService
class.
AsyncBrokerServiceBase.setInvoker(AsyncInvoker)
public EventReceivingBrokerService(AsyncInvoker invoker)
EventReceivingBrokerService
class.
Method Detail |
---|
public void onMessage(Message message)
onMessage
in interface MessageHandler
message
- message for publishingDuplexChannel.setMessageHandler(MessageHandler)
,
AsyncBrokerServiceBase.setInvoker(AsyncInvoker)
@Deprecated public void processMessage(Message message)
processMessage
in interface MessageReceiverSupport
@Deprecated public Message receive() throws java.lang.InterruptedException
receive
in interface MessageReceiver<Message>
java.lang.UnsupportedOperationException
java.lang.InterruptedException
- if thread is interrupted during this method
executionBrokerServiceBase.register(Subscriber)
,
BrokerServiceBase.register(Action, Predicate)
@Deprecated public Message receive(long arg0) throws java.lang.InterruptedException, java.lang.IllegalStateException
receive
in interface MessageReceiver<Message>
arg0
- timeout to waitResponse for message
java.lang.UnsupportedOperationException
java.lang.InterruptedException
- if thread is interrupted during this method
execution
java.lang.IllegalStateException
- if channel is not in appropriate state
to call the methodBrokerServiceBase.register(Subscriber)
,
BrokerServiceBase.register(Action, Predicate)
@Deprecated public void clearInput()
Receiver
clearInput
in interface Receiver
@Deprecated public int getInputSize()
Receiver
getInputSize
in interface Receiver
@Deprecated public void releaseReceivers()
Receiver
releaseReceivers
in interface Receiver
@Deprecated public void setInputSize(int arg0)
Receiver
setInputSize
in interface Receiver
arg0
- maximum count of messages stored in receiver@Deprecated public void onChannelClosed(ChannelClosedEvent event)
ChannelListener
onChannelClosed
in interface ChannelListener
event
- details. See event.getCause() to analize the source reason.@Deprecated public void onChannelError(ChannelErrorEvent event)
ChannelListener
onChannelError
in interface ChannelListener
event
- details. See event.getCause() to analize the problem source.@Deprecated public void onChannelOpened(java.util.EventObject event)
ChannelListener
onChannelOpened
in interface ChannelListener
event
- details.
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |