Platform SDK Java 8.5 API Reference

com.genesyslab.platform.applicationblocks.commons.broker
Class RequestReceivingBrokerService

java.lang.Object
  extended by com.genesyslab.platform.applicationblocks.commons.broker.BrokerServiceBase<T>
      extended by com.genesyslab.platform.applicationblocks.commons.broker.AsyncBrokerServiceBase<RequestContext>
          extended by com.genesyslab.platform.applicationblocks.commons.broker.RequestReceivingBrokerService
All Implemented Interfaces:
PublishingService<RequestContext>, SubscriptionService<RequestContext>, AsyncInvokerSupport, ChannelListener, Listener, Receiver, ReceiverSupport, RequestReceiver, RequestReceiverSupport

Deprecated. Message Broker Application Block is deprecated. Use 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);
         }
     }
 


Field Summary
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver
DEF_INPUT_SIZE
 
Constructor Summary
RequestReceivingBrokerService()
          Deprecated. Creates an instance of RequestReceivingBrokerService class.
RequestReceivingBrokerService(AsyncInvoker invoker)
          Deprecated. Creates an instance of RequestReceivingBrokerService class.
 
Method Summary
 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".
 
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

RequestReceivingBrokerService

public RequestReceivingBrokerService()
Deprecated. 
Creates an instance of RequestReceivingBrokerService class.

See Also:
AsyncBrokerServiceBase.setInvoker(AsyncInvoker)

RequestReceivingBrokerService

public RequestReceivingBrokerService(AsyncInvoker invoker)
Deprecated. 
Creates an instance of RequestReceivingBrokerService class.

Method Detail

processRequest

public void processRequest(RequestContext request)
Deprecated. 
Specified by:
processRequest in interface RequestReceiverSupport

receiveRequest

public RequestContext receiveRequest()
                              throws java.lang.InterruptedException,
                                     java.lang.IllegalStateException
Deprecated. 
It is not supposed to receive requests directly. Messages are delivered by subscriptions.

Specified by:
receiveRequest in interface RequestReceiver
Returns:
Message from the channel or null if the channel is "empty"
Throws:
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 method
See Also:
BrokerServiceBase.register(Subscriber), BrokerServiceBase.register(Action, Predicate)

receiveRequest

public RequestContext receiveRequest(long timeout)
                              throws java.lang.InterruptedException,
                                     java.lang.IllegalStateException
Deprecated. 
It is not supposed to receive requests directly. Messages are delivered by subscriptions.

Specified by:
receiveRequest in interface RequestReceiver
Parameters:
timeout - timeout to waitResponse for message
Returns:
Message from the channel or null if the channel is "empty"
Throws:
java.lang.UnsupportedOperationException
java.lang.InterruptedException - if thread is interrupted during this method execution
ChannelNotOpenedException - if channel is not in appropriate state to call the method
java.lang.IllegalStateException
See Also:
BrokerServiceBase.register(Subscriber), BrokerServiceBase.register(Action, Predicate)

clearInput

public void clearInput()
Deprecated. 
Description copied from interface: Receiver
Clears input of the receiver. Please note, that there is no strict guaranties that input will be empty after this method has returned, the messages could be delivered by another thread.

Specified by:
clearInput in interface Receiver

getInputSize

public int getInputSize()
Deprecated. 
Description copied from interface: Receiver
Returns the amount of messages this Receiver can hold before start to "forget stale messages".

Specified by:
getInputSize in interface Receiver
Returns:
maximum count of messages stored in receiver

releaseReceivers

public void releaseReceivers()
Deprecated. 
Description copied from interface: Receiver
Notifies receivers (threads waiting on receive() methods) they should stop waiting and return null.

Specified by:
releaseReceivers in interface Receiver

setInputSize

public void setInputSize(int arg0)
Deprecated. 
Description copied from interface: Receiver
Sets the amount of messages this Receiver can hold before start to "forget stale messages".

Specified by:
setInputSize in interface Receiver
Parameters:
arg0 - maximum count of messages stored in receiver

onChannelClosed

public void onChannelClosed(ChannelClosedEvent event)
Deprecated. 
Description copied from interface: ChannelListener
onChannelClosed is called when the channel closed by any reason.

Specified by:
onChannelClosed in interface ChannelListener
Parameters:
event - details. See event.getCause() to analize the source reason.

onChannelError

public void onChannelError(ChannelErrorEvent event)
Deprecated. 
Description copied from interface: ChannelListener
onChannelError is called when some not critical channel error occurs. (like unknown attribute in message occurs)

Specified by:
onChannelError in interface ChannelListener
Parameters:
event - details. See event.getCause() to analize the problem source.

onChannelOpened

public void onChannelOpened(java.util.EventObject event)
Deprecated. 
Description copied from interface: ChannelListener
onChannelOpened is called when the channel opening will be completed successfully.

Specified by:
onChannelOpened in interface ChannelListener
Parameters:
event - details.

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.