Openfire serverside subscription to a node

hi

i am writing a plugin for openfire. in this plugin i want to create node and subscribe clients to this node. i am successful in creating the nodes but i am unable to subscribe client to it. i am using this code to subscibe client but didnt worked for me.

Node retreived = pubsub.getNode(nodeId); NodeSubscription subscription = new NodeSubscription(retreived, new JID(“dinga@exalanche”), new JID(“dinga@exalanche”), State.subscribed, “sdfsdfdsds”); retreived.addSubscription(subscription); retreived.approveSubscription(subscription, true); retreived.saveToDB();

Check the Node.createSubscription() method.

You have to add an affiliation as well. Doing it this way does bypass a lot of checks, so be careful that you don’t leave the pubsub system in an inconsistent state.