See: Description
Interface | Description |
---|---|
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 | Description |
---|---|
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.
|
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. }
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. }