Platform SDK Java 8.5 API Reference

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

java.lang.Object
  extended by com.genesyslab.platform.applicationblocks.commons.broker.BrokerServiceBase<T>
      extended by com.genesyslab.platform.applicationblocks.commons.broker.MessageBrokerService<RequestContext>
          extended by com.genesyslab.platform.applicationblocks.commons.broker.RequestBrokerService
All Implemented Interfaces:
PublishingService<RequestContext>, SubscriptionService<RequestContext>

Deprecated. Message Broker Application Block is deprecated. Use setMessageHandler(handler) to handle incoming messages asynchronously.

@Deprecated
public class RequestBrokerService
extends MessageBrokerService<RequestContext>

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);
         }
     }
 
This class has a specific behavior - it performs synchronous wait in AsyncInvoker for incoming events, so, it requires dedicated invoker to be permanently busy with reading task. The alternative for broker service functionality without fully occupied invoker is to use RequestReceivingBrokerService which is a receiver by itself and can be used as "external receiver" in protocol connections to handle messages directly without intermediate queues.


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

RequestBrokerService

public RequestBrokerService()
Deprecated. 
Creates an instance of 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.


RequestBrokerService

public RequestBrokerService(RequestReceiver theReceiver)
Deprecated. 
Creates an instance of RequestBrokerService class.

Parameters:
theReceiver - Initializes request receiver
Method Detail

getReceiver

public RequestReceiver getReceiver()
Deprecated. 
Gets request receiver.

Returns:
receiver

setReceiver

public void setReceiver(RequestReceiver value)
Deprecated. 
Sets request receiver.

Parameters:
value - request receiver

receive

protected RequestContext receive()
                          throws java.lang.InterruptedException
Deprecated. 
Receives request messages.

Specified by:
receive in class MessageBrokerService<RequestContext>
Returns:
request context of received message
Throws:
java.lang.InterruptedException

getGenericReceiver

protected Receiver getGenericReceiver()
Deprecated. 
Gets generic receiver. Generic receiver is able to receive both: event and request messages.

Specified by:
getGenericReceiver in class MessageBrokerService<RequestContext>
Returns:
generic receiver

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.