Adding Registry Listener in PEtALS

I just added a new feature to petals ESB (to be released quite soon in v3.0) in order to customize the Service Bus endpoint registration and unregistration…

The interface to implement is defined in org.ow2.petals.jbi.messaging.registry.RegistryListener such as :

package org.ow2.petals.jbi.messaging.registry;

import org.ow2.petals.jbi.messaging.endpoint.ServiceEndpoint;

public interface RegistryListener {

void onRegister(ServiceEndpoint endpoint);

void onUnregister(ServiceEndpoint endpoint);

}

Note that for now, the listeners are just called for local endpoints (remote endpoints listeners will be added in a future version). In order to add registry listeners, you just have to implement the RegistryListener interface and to add the listeners to the registry in the Fractal configuration file (JBI-Messaging.fractal).

In order to illustrate how to add a listener in the Fractal configuration file, let’s take an example. All the following lines are added to the JBI-Messagging.fractal configuration file.

1. Add a new component implementation which implements the RegistryListener interface :

<component definition="org.ow2.petals.kernel.registry.listener.wsdm.MonitoringNotifierImpl" name="MonitoringNotifierImpl"/>

2. Bind the new component with required ones (depends on the implementation) :

<binding client="MonitoringNotifierImpl.configuration" server="this.configuration"/>

3. Add the listener to the EndpointRegistry component :

<binding client="EndpointRegistryImpl.listener-wsdmnotif" server="MonitoringNotifierImpl.service"/>

Note that the binding client name MUST start with the « listener- » prefix in order to be added to the list of listeners.

Here we are, on endpoint registration and unregistration, the list of listeners will be called by the endpoint registry component. You can now specialize your endpoints lifecycle. A real use case will come in a future post, so stay tuned.


Une réflexion sur “Adding Registry Listener in PEtALS

  1. Pingback: PEtALS ESB Live Monitoring with WSDM and GWT « Christophe Hamerling's TechBlog

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s