SAP NetWeaver '04

com.sap.netweaver.bc.rf.util.event
Interface IEventBroker

[contained in: com.sap.netweaver.bc.rf.par - bc.rf.util_api.jar]
All Known Implementing Classes:
EventBroker

public interface IEventBroker

The event broker is a mediator between event senders (IEventSender) and receivers (IEventReceiver). All senders and receivers must register themselfs with a broker. All receivers will receive events from all senders but it is possible to register for different event "templates" (event class and type). Usually a sender will instantiate its own broker and register itself.


Field Summary
static int PRIO_MAX
           
static int PRIO_MIN
           
 
Method Summary
 IEventList clearHoldEvents(IEventReceiver receiver)
          Remove all hold but not yet sent events for the given receiver.
 IEventList getEvents()
          Returns a list of event templates for all possible events this broker can send (determined by querying all registered senders).
 IEventList getHoldEvents(IEventReceiver receiver)
          Get all hold but not yet sent events for the given receiver.
 ReceiverMode getMode(IEventReceiver receiver)
          Get the receiver mode of the receiver, i.e. off, sending and so on.
 void hold(IEventReceiver receiver, boolean collect)
          TBD: Unknown function.
 void register(IEventReceiver receiver, IEvent template)
          Registers an event receiver.
 void register(IEventReceiver receiver, IEvent template, IEventMapper mapper)
          See the general contract of the register(IEventReceiver, IEvent) method.
 void register(IEventReceiver receiver, IEvent template, IEventMapper mapper, int priority, boolean async)
          See the general contract of the register(IEventReceiver, IEvent, IEventMapper) and register(IEventReceiver, IEvent, int, boolean) method.
 void register(IEventReceiver receiver, IEvent template, int priority, boolean async)
          See the general contract of the register(IEventReceiver, IEvent) method.
 void register(IEventSender sender)
          Registers an event sender instance.
 void resume(IEventReceiver receiver)
          Resumes a previously suspended event receiver.
 void send(IEvent event, IEventSender sender)
          Sends the specified event to all receivers that have registered for this kind of event.
 void suspend(IEventReceiver receiver)
          Suspend the event receiver.
 void unregister(IEventReceiver receiver, IEvent template)
          Unregisteres an event receiver instance.
 void unregister(IEventSender sender)
          Unregisteres an event sender instance.
 

Field Detail

PRIO_MAX

public static final int PRIO_MAX

PRIO_MIN

public static final int PRIO_MIN
Method Detail

send

public void send(IEvent event,
                 IEventSender sender)
          throws BaseException
Sends the specified event to all receivers that have registered for this kind of event.
Parameters:
event - event to be sent
sender - event sender instance sending the event
Throws:
BaseException - when the event sender is not registered

register

public void register(IEventSender sender)
              throws BaseException
Registers an event sender instance.
Parameters:
sender - event sender to be registered
Throws:
BaseException - when the registration fails

register

public void register(IEventReceiver receiver,
                     IEvent template)
              throws BaseException
Registers an event receiver. The receiver will only receive events which match the template event. This depends on the matching rules implemented in the events IEvent.isLike(com.sap.netweaver.bc.rf.util.event.IEvent) method. Usually the event's instance and type are relevant. It is allowed to register the same event receiver instance several times with different templates.
Parameters:
receiver - event receiver to be registered
template - event template on which the event receiver will receive events
Throws:
BaseException - when the registration fails

register

public void register(IEventReceiver receiver,
                     IEvent template,
                     IEventMapper mapper)
              throws BaseException
See the general contract of the register(IEventReceiver, IEvent) method. This regstration method has an additional IEventMapper argument, i.e. that the mapper will be called prior to giving the event to the receiver.
Parameters:
receiver - event receiver to be registered
template - event template on which the event receiver will receive events
mapper - event mapper to be called prior to giving the event to the receiver
Throws:
BaseException - when the registration fails
See Also:
IEventMapper

register

public void register(IEventReceiver receiver,
                     IEvent template,
                     int priority,
                     boolean async)
              throws BaseException
See the general contract of the register(IEventReceiver, IEvent) method. This regstration method has two additional arguments for priority and asynchronous events.

The priority controls the order of multible receivers which have registered for the same event(s). Receivers with higher priority (smaller values) will receive an event before receivers with lower priority (greater values).

An event receiver can choose to receive events asynchronously. This means that a dedicated event queue and sender thread is created for each receiver and template. The event sender will not be blocked, that means the send() method puts the event into the queue and returns immediatelly.

Parameters:
receiver - event receiver to be registered
template - event template on which the event receiver will receive events
priority - priority of this receiver and template
async - true when the receiver whould receive the events on a seperate thread
Throws:
BaseException - when the registration fails

register

public void register(IEventReceiver receiver,
                     IEvent template,
                     IEventMapper mapper,
                     int priority,
                     boolean async)
              throws BaseException
See the general contract of the register(IEventReceiver, IEvent, IEventMapper) and register(IEventReceiver, IEvent, int, boolean) method.
Parameters:
receiver - event receiver to be registered
template - event template on which the event receiver will receive events
mapper - event mapper to be called prior to giving the event to the receiver
priority - priority of this receiver and template
async - true when the receiver whould receive the events on a seperate thread
Throws:
BaseException - when the registration fails
See Also:
IEventMapper

unregister

public void unregister(IEventSender sender)
                throws BaseException
Unregisteres an event sender instance.
Parameters:
sender - event sender to be unregistered
Throws:
BaseException - when the unregistration fails

unregister

public void unregister(IEventReceiver receiver,
                       IEvent template)
                throws BaseException
Unregisteres an event receiver instance.
Parameters:
receiver - event receiver to be unregistered
template - event template on which the event receiver will no longer receive events
Throws:
BaseException - when the unregistration fails

suspend

public void suspend(IEventReceiver receiver)
Suspend the event receiver. The broker will stop delivering any events until resume(com.sap.netweaver.bc.rf.util.event.IEventReceiver) is called.
Parameters:
receiver - event receiver

resume

public void resume(IEventReceiver receiver)
Resumes a previously suspended event receiver. The broker will continue delivering events to the receiver.
Parameters:
receiver - event receiver

hold

public void hold(IEventReceiver receiver,
                 boolean collect)
TBD: Unknown function.
Parameters:
receiver - TBD: Unknown parameter
collect - TBD: Unknown parameter

getMode

public ReceiverMode getMode(IEventReceiver receiver)
Get the receiver mode of the receiver, i.e. off, sending and so on.
Parameters:
receiver - event receiver
Returns:
receiver mode of the receiver
See Also:
ReceiverMode

getHoldEvents

public IEventList getHoldEvents(IEventReceiver receiver)
Get all hold but not yet sent events for the given receiver.
Parameters:
receiver - event receiver
Returns:
all hold but not yet sent events for the given receiver

clearHoldEvents

public IEventList clearHoldEvents(IEventReceiver receiver)
Remove all hold but not yet sent events for the given receiver.
Parameters:
receiver - event receiver
Returns:
all hold but not yet sent events for the given receiver

getEvents

public IEventList getEvents()
Returns a list of event templates for all possible events this broker can send (determined by querying all registered senders). The event instances contained in the list are "templates", that means the event parameter is not relevant.
Returns:
list of event templates for all possible events this broker can send

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.