IBM WebSphere Application ServerTM
Release 8

Package com.ibm.events.emitter

This package contains the classes and interfaces required for using an event emitter.

See:
          Description

Interface Summary
Emitter This is the interface for the event emitter.
EmitterFactory This interface is used by event sources to create emitter instances.
SynchronizationMode Constants used to specify whether to send an event to the event service synchronously or asynchronously.
TransactionMode Constants used to specify whether to send an event to the event service in the same transaction as the caller or in a new transaction.
 

Exception Summary
EmitterException Indicates that an error has occurred during emitter processing.
SendFailureException Indicates that a problem occurred in the emitter processing when sending an event to the event service.
SynchronizationModeNotSupportedException Indicates that the caller attempted to use a synchronization mode that is not supported by the emitter.
TransactionModeNotSupportedException Indicates that the caller attempted to use a transaction mode that is not supported by the emitter.
 

Package com.ibm.events.emitter Description

This package contains the classes and interfaces required for using an event emitter.

Code sample for submitting an event using default emitter settings in a J2EE environment

    try {
        javax.naming.Context ctx = new javax.naming.InitialContext();
        EmitterFactory emitterFactory = (EmitterFactory) ctx.lookup("com/ibm/events/configuration/emitter/Default");
        Emitter emitter = emitterFactory.getEmitter();

        EventFactory eventFactory = (EventFactory) ctx.lookup("com/ibm/events/EventFactory");
        org.eclipse.hyades.logging.events.cbe.CommonBaseEvent event = eventFactory.createCommonBaseEvent();

        // Configure various fields in the event.

        emitter.sendEvent(event);
    } catch (org.eclipse.hyades.logging.events.cbe.ValidationException validationException) {
        // The Emitter.sendEvent method found that the event was invalid.
    } catch (com.ibm.events.EventsException eventsException) {
        // EmitterFactory.getEmitter or Emitter.sendEvent failed.
    } catch (javax.naming.NamingException namingException) {
        // A JNDI method threw an exception.
    }

Code sample for submitting an event using overridden emitter settings from a J2SE environment

    try {
        java.util.Hashtable jndiConfig = new java.util.Hashtable();
        jndiConfig.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
        jndiConfig.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2809");
        javax.naming.Context ctx = new javax.naming.InitialContext(jndiConfig);
        EmitterFactory emitterFactory = (EmitterFactory) ctx.lookup("com/ibm/events/configuration/emitter/Default");
        Emitter emitter = emitterFactory.getEmitter();

        EventFactory eventFactory = (EventFactory) ctx.lookup("com/ibm/events/configuration/event-groups/Default");
        org.eclipse.hyades.logging.events.cbe.CommonBaseEvent event = eventFactory.createEvent();

        // Configure various fields in the event.

        emitter.sendEvent(event, SychronizationMode.ASYNCHRONOUS, TransactionMode.NEW);
    } catch (org.eclipse.hyades.logging.events.cbe.ValidationException validationException) {
        // The Emitter.sendEvent method found that the event was invalid.
    } catch (com.ibm.events.EventsException eventsException) {
        // EmitterFactory.getEmitter or Emitter.sendEvent method failed.
    } catch (javax.naming.NamingException namingException) {
        // A JNDI method threw an exception.
    }

Version:
1.1.0

IBM WebSphere Application ServerTM
Release 8