JBoss.org Community Documentation

9.19.3.5. Emitting notifications

JBossWS-Eventing registers a event dispatcher within local JNDI tree that can be used to emit notifications from applications.

 
java:/EventDispatcher
 

The event dispatcher interface:

 
public interface EventDispatcher
{
void dispatch(URI eventSourceNS, Element payload);
}
 

Example notification

 
(1)   URI eventSourceURI = new URI("http://http://www.jboss.org/sysmon/SystemInfo");
(2)   Element payload = DOMUtils.parse("SOME XML STRING");
try
{
InitialContext iniCtx = getInitialContext();
(3)      EventDispatcher delegate = (EventDispatcher)
iniCtx.lookup(EventingConstants.DISPATCHER_JNDI_NAME);
(4)      delegate.dispatch(eventSourceURI, payload);
}
catch (Exception e)
{
//
}
 
  1. Address your event source correctly (TargetNamespace+PortTypeName)

  2. Create your payload

  3. Lookup dispatcher from JNDI

  4. Dispatch notification.

The SubscriptionManager MBean is the actual core component that drives the JBossWS-Eventing implementation. It can be accessed through the jmx-console.

 
jboss.ws.eventing:service=SubscriptionManager
 

Management operations exist to monitor and maintain active subscriptions and deployed event sources. The current implementation is backed by a ThreadPoolExecutor, that asynchronously delivers messages to event sink endpoints. It can be configured through the following attributes:

  • corePoolSize - average number of idle threads

  • maximumPoolSize - maximum number of threads

  • eventKeepAlive - keep alive before an undelivered event message is discarded.