powered by Jive Software

Handle events for custom provider

i am tryting to create a custom provider and then want to listen for incoming items after subscribing to a node

so far i have create a **LocationExtension **and **LocationProvider **classes and register a custom provider in smack.providers programatically


pm.addExtensionProvider(

“location”,

“pubsub:test:location”,

new com.bcl.provider.LocationProvider());

i am able to pares the incoming location element in **LocationProvider **as it implements PacketExtensionProvider.

Now the issue is when i try to register a listener for incoming locaiton elements as follows , my handler is not getting called

node = (LeafNode) mgr.getNode(“mynode/loc”);

ItemEventCoordinator<PayloadItem<LocationExtension>> locationHandler =

new ItemEventCoordinator<PayloadItem<LocationExtension>>();

node.addItemEventListener(locationHandler);

                node.subscribe("myjid@example.com");

Here is the event listener class which is not getting called , can any one tell me wht am i missing ?

class ItemEventCoordinator implements ItemEventListener{

public void handlePublishedItems(ItemPublishEvent items){

System.out.println(“called”);

}

@Override

public String toString()

{

return "ItemEventCoordinator: " + id;

}

}

Can anyone plz help me over here , did anyone have face this before ?