Platform SDK Java 8.5 API Reference

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

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

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

@Deprecated
public class EventBrokerService
extends MessageBrokerService<Message>

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);
         }
     }
 
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 EventReceivingBrokerService 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
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

EventBrokerService

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


EventBrokerService

public EventBrokerService(MessageReceiver<Message> receiver)
Deprecated. 
Creates an instance of EventBrokerService class.

Parameters:
receiver - message receiver
Method Detail

activate

public static EventBrokerService activate(MessageReceiver<Message> receiver)
Deprecated. 


getReceiver

public MessageReceiver<Message> getReceiver()
Deprecated. 

setReceiver

public void setReceiver(MessageReceiver<Message> value)
Deprecated. 

dispose

public void dispose()
Deprecated. 
Description copied from class: MessageBrokerService
Disposes of the service.

Overrides:
dispose in class MessageBrokerService<Message>

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<Message>
Returns:
generic receiver

receive

protected Message receive()
                   throws java.lang.InterruptedException
Deprecated. 
Receives event messages.

Specified by:
receive in class MessageBrokerService<Message>
Returns:
new incoming message or null on timeout
Throws:
java.lang.InterruptedException

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.