This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

  Apache ServiceMix NMR #usernavbar() #printableicon() #pdficon() #feedicon()  
When you contribute content to this Wiki, you grant a license to the ASF for inclusion in ASF works (as per the Apache Software License).
  10. Events
Skip to end of metadata
Go to start of metadata


10. Events

The NMR has a rich event API that can be used to receive all sort of notifications about what's happening in the NMR.
Currently, two types of listeners are defined.


public interface EndpointListener { void endpointRegistered(InternalEndpoint endpoint); void endpointUnregistered(InternalEndpoint endpoint); }

You can find an example endpoint listener here.


public interface ExchangeListener { void exchangeSent(Exchange exchange); void exchangeDelivered(Exchange exchange); void exchangeFailed(Exchange exchange); }

An example exchange listener can be found here.

Registering listeners

Listeners can be registered in two ways, either directly on the NMR:

nmr.getListenerRegistry().register(listener, null);

or by registering your listener as an OSGi service. It can be done using Spring-DM using the following configuration (for an exchange listener):

<bean id="myListener" class="..."> ... </bean> <!-- Exchange Listener --> <osgi:service ref="myListener"> <osgi:interfaces> <value>org.apache.servicemix.nmr.api.event.ExchangeListener</value> <value>org.apache.servicemix.nmr.api.event.Listener</value> </osgi:interfaces> </osgi:service>


  • No labels