Platform SDK Java 8.5 API Reference

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

java.lang.Object
  extended by com.genesyslab.platform.applicationblocks.commons.broker.BrokerServiceBase<T>
      extended by com.genesyslab.platform.applicationblocks.commons.broker.AsyncBrokerServiceBase<Message>
          extended by com.genesyslab.platform.applicationblocks.commons.broker.EventReceivingBrokerService
All Implemented Interfaces:
PublishingService<Message>, SubscriptionService<Message>, AsyncInvokerSupport, ChannelListener, Listener, MessageHandler, MessageReceiver<Message>, MessageReceiverSupport, Receiver, ReceiverSupport

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

@Deprecated
public class EventReceivingBrokerService
extends AsyncBrokerServiceBase<Message>
implements MessageReceiverSupport, MessageHandler

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);
         }
     }
 
Broker service can be shared between several protocol connections (may be of different type):
[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);
     ...
 
By this way eventBroker will handle all incoming messages from all initialized protocols one by one, using its invoker.

See Also:
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

EventReceivingBrokerService

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

See Also:
AsyncBrokerServiceBase.setInvoker(AsyncInvoker)

EventReceivingBrokerService

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

Method Detail

onMessage

public void onMessage(Message message)
Deprecated. 
Enqueues message for publishing by the invoker.

Specified by:
onMessage in interface MessageHandler
Parameters:
message - message for publishing
See Also:
DuplexChannel.setMessageHandler(MessageHandler), AsyncBrokerServiceBase.setInvoker(AsyncInvoker)

processMessage

@Deprecated
public void processMessage(Message message)
Deprecated. this interface is going to be removed from this class

Specified by:
processMessage in interface MessageReceiverSupport

receive

@Deprecated
public Message receive()
                throws java.lang.InterruptedException
Deprecated. this interface is going to be removed from this class

It is not supposed to receive messages directly. Messages are delivered by subscriptions.

Specified by:
receive in interface MessageReceiver<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
See Also:
BrokerServiceBase.register(Subscriber), BrokerServiceBase.register(Action, Predicate)

receive

@Deprecated
public Message receive(long arg0)
                throws java.lang.InterruptedException,
                       java.lang.IllegalStateException
Deprecated. this interface is going to be removed from this class

It is not supposed to receive messages directly. Messages are delivered by subscriptions.

Specified by:
receive in interface MessageReceiver<Message>
Parameters:
arg0 - 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
java.lang.IllegalStateException - if channel is not in appropriate state to call the method
See Also:
BrokerServiceBase.register(Subscriber), BrokerServiceBase.register(Action, Predicate)

clearInput

@Deprecated
public void clearInput()
Deprecated. this interface is going to be removed from this class

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

@Deprecated
public int getInputSize()
Deprecated. this interface is going to be removed from this class

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

@Deprecated
public void releaseReceivers()
Deprecated. this interface is going to be removed from this class

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

@Deprecated
public void setInputSize(int arg0)
Deprecated. this interface is going to be removed from this class

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

@Deprecated
public void onChannelClosed(ChannelClosedEvent event)
Deprecated. this interface is going to be removed from this class

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

@Deprecated
public void onChannelError(ChannelErrorEvent event)
Deprecated. this interface is going to be removed from this class

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

@Deprecated
public void onChannelOpened(java.util.EventObject event)
Deprecated. this interface is going to be removed from this class

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.