PublishingService<T>
, SubscriptionService<T>
, AsyncInvokerSupport
, ChannelListener
, Listener
, Receiver
, ReceiverSupport
, RequestReceiver
, RequestReceiverSupport
, InvokerInfo
setMessageHandler(handler)
to handle incoming messages asynchronously.@Deprecated public class RequestReceivingBrokerService extends AsyncBrokerServiceBase<RequestContext> implements RequestReceiverSupport
RequestReceivingBrokerService
class is designed to work with request messages on server side.
[Java]
final String protocolName = "CustomRouter";
UrsCustomProtocolListener ursServer;
RequestReceivingBrokerService requestBroker;
public void initialize() {
Endpoint endpoint = new Endpoint(
protocolName,
"localhost", 9999);
ursServer = new UrsCustomProtocolListener(endpoint);
requestBroker = new RequestReceivingBrokerService(
new SingleThreadInvoker("RequestReceivingBrokerService-1"));
requestBroker.register(new MyHandler(), null);
ursServer.setReceiver(requestBroker);
ursServer.open();
}
class MyHandler implements Action<RequestContext> {
public void handle(final RequestContext context) {
Message request = context.getRequestMessage();
// ...
Message response = EventSomeResponse.create(
"Operation result");
// ...
context.respond(response);
}
}
DEF_INPUT_SIZE
Constructor | Description |
---|---|
RequestReceivingBrokerService() |
Deprecated.
Creates an instance of
RequestReceivingBrokerService class. |
RequestReceivingBrokerService(AsyncInvoker invoker) |
Deprecated.
Creates an instance of
RequestReceivingBrokerService class. |
Modifier and Type | Method | Description |
---|---|---|
void |
clearInput() |
Deprecated.
Clears input of the receiver.
|
int |
getInputSize() |
Deprecated.
Returns the amount of messages this Receiver can hold before
start to "forget stale messages".
|
void |
onChannelClosed(ChannelClosedEvent event) |
Deprecated.
onChannelClosed is called when the channel closed by any reason.
|
void |
onChannelError(ChannelErrorEvent event) |
Deprecated.
onChannelError is called when some not critical channel error occurs.
|
void |
onChannelOpened(java.util.EventObject event) |
Deprecated.
onChannelOpened is called when the channel opening will be completed successfully.
|
void |
processRequest(RequestContext request) |
Deprecated.
|
RequestContext |
receiveRequest() |
Deprecated.
It is not supposed to receive requests directly.
|
RequestContext |
receiveRequest(long timeout) |
Deprecated.
It is not supposed to receive requests directly.
|
void |
releaseReceivers() |
Deprecated.
Notifies receivers (threads waiting on receive() methods) they should
stop waiting and return null.
|
void |
setInputSize(int arg0) |
Deprecated.
Sets the amount of messages this Receiver can hold before
start to "forget stale messages".
|
getInvokesCount, getInvokesRejected, getQueueMaxSize, getQueueSize, publish, setInvoker
notify, onNotificationException, onPublish, register, register, switchSubscribersList, unregister, unregister, unregisterAll
public RequestReceivingBrokerService()
RequestReceivingBrokerService
class.public RequestReceivingBrokerService(AsyncInvoker invoker)
RequestReceivingBrokerService
class.public void processRequest(RequestContext request)
processRequest
in interface RequestReceiverSupport
public RequestContext receiveRequest() throws java.lang.InterruptedException, java.lang.IllegalStateException
receiveRequest
in interface RequestReceiver
java.lang.UnsupportedOperationException
java.lang.InterruptedException
- if thread is interrupted during this method
executionjava.lang.IllegalStateException
- if channel is not in appropriate state
to call the methodBrokerServiceBase.register(Subscriber)
,
BrokerServiceBase.register(Action, Predicate)
public RequestContext receiveRequest(long timeout) throws java.lang.InterruptedException, java.lang.IllegalStateException
receiveRequest
in interface RequestReceiver
timeout
- timeout to waitResponse for messagejava.lang.UnsupportedOperationException
java.lang.InterruptedException
- if thread is interrupted during this method
executionChannelNotOpenedException
- if channel is not in appropriate state
to call the methodjava.lang.IllegalStateException
BrokerServiceBase.register(Subscriber)
,
BrokerServiceBase.register(Action, Predicate)
public void clearInput()
Receiver
clearInput
in interface Receiver
public int getInputSize()
Receiver
getInputSize
in interface Receiver
public void releaseReceivers()
Receiver
releaseReceivers
in interface Receiver
public void setInputSize(int arg0)
Receiver
setInputSize
in interface Receiver
arg0
- maximum count of messages stored in receiverpublic void onChannelClosed(ChannelClosedEvent event)
ChannelListener
onChannelClosed
in interface ChannelListener
event
- details. See event.getCause() to analize the source reason.public void onChannelError(ChannelErrorEvent event)
ChannelListener
onChannelError
in interface ChannelListener
event
- details. See event.getCause() to analize the problem source.public void onChannelOpened(java.util.EventObject event)
ChannelListener
onChannelOpened
in interface ChannelListener
event
- details.Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 9.0.006.00
Copyright © 2006–2019 Genesys Telecommunications Laboratories, Inc. All rights reserved.