how to test PEP

Submitted by Anonymous on Fri, 2009-06-05 13:42

I am trying to test the PEP functionality with the latest build 1720. I
used PSI's xml console to send the xml to publish exactly from
XEP-0163 with "from" field replaced with my own jid. However
tigase seemed to consider it error because "to" field is
missing and returns "feature not supported". I tried sending
xml in pubsub/src/test/createNode.cor and that works. Did I miss
something or tigase does not support PEP yet? I tried with mood as
well

The request is as below.
<iq from='thetwo@doom2/Doom' type='set'
id='pub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='http://jabber.org/protocol/tune'>
<item>
<tune xmlns='http://jabber.org/protocol/tune'>
<artist>Gerald Finzi</artist>
<length>255</length>
<source>Music for "Love's Labors Lost"
(Suite for small orchestra)</source>
<title>Introduction (Allegro vigoroso)</title>
<track>1</track>
</tune>
</item>
</publish>
</pubsub>
</iq>

The reponse:
I tried test cases in pubsub/src/test/createNode.cor. That works.
<iq type="error" to="thetwo@doom2/Doom"
id="pub1" >
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="http://jabber.org/protocol/tune" >
<item>
<tune xmlns="http://jabber.org/protocol/tune">
<artist>Gerald Finzi</artist>
<length>255</length>
<source>Music for "Love's Labors Lost"
(Suite for small orchestra)</source>
<title>Introduction (Allegro vigoroso)</title>
<track>1</track>
</tune>
</item>
</publish>
</pubsub>
<error type="cancel" code="501" >
<feature-not-implemented
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"
xml:lang="en" >Feature not supported yet.</text>
</error>
</iq>

And in tigase log:

PacketFilter.process() INFO: No 'to'
address, can't deliver packet:
SessionManager.processPacket() FINEST: Packet not processed:

Artur Hefczyc's picture

Yes, this is correct, a new

Yes, this is correct, a new Pep plugin has been implemented which is completely independent from the PubSub component. The Pep can be activated even if the PubSub component is not.
A new ID for the component is 'pep'.
Normally, the syntax is:

--sm-plugins=+pep,-starttls,+zlib

However the '+' sign can be skipped.

dayu's picture

Can you confirm that

Can you confirm that "--sm-plugins=+pubsub" should be replaced with "--sm-plugins=pep" for PEP support in the next release?

Please ignore my last

Please ignore my last question about cluster. It was my usage error.

I have another question about PEP protocol and tigase implementation.

According to XEP0163 Section 3, "Publishing Events", the PEP service must create the node if an item is published to a node. My understanding is that server must save the item in the persistent storage which is the database. And in Section 4.3.4 "Sending the Last Published Item", the last published item must be sent to all new subscribers. This seems to require that the item is saved in a persistent storage.

If that is the case, is it possible to use the PEP protocol like tune or mood as node name, the timestamp as item id, and save the published PEP content as data under the protocol/'items'/timestamp subnode just like pubsub?

Thanks for your explanation

Thanks for your explanation of your choice of roster format.

I had another question that was buried in the thread.

What if I have the cluster setting in init.properties like the following?

--comp-class-1 = tigase.pubsub.PubSubClusterComponent

What's the syntax for plugins-conf then? If I still use sess-man/plugins-conf/pubsub/pubsub-component = pubsub.vhost, then the client cannot login. The connection mananger's service got stopped somehow.

Artur Hefczyc's picture

First of all I am sorry for

First of all I am sorry for delayed response. Second, thank you for your patience and the effort you made to investigate the problem.
Looks like there is a bug in PubSub and you are right, the PubSub tries to uses the old style of roster storing. Actually, the real problem is that PubSub directly accesses database instead of using Tigase API to retrieve a user roster. If the API was used then changes to the database wouldn't break anything.
I will fix this so the final release will behave correctly.

The new style to store roster is actually much more efficient. It just offers a very fast way to load the roster when users logins in. The old way required executions lots of SQL queries to load the user roster. For large rosters it was just unusable.

Roster Incompatibility After

Roster Incompatibility

After I manually added "roster" subnode, buddy jid subnode, and subscription key in the database, PEP works like a charm.

After further checking the code, specifically from RosterFlat.java and Roster.java in the server code, I discover that it seems to be considered old style to save roster information in the roster subnode. The current way is to save roster as a flat xml directly in tig_pairs table. And tigase server will try to convert the old style to to new one automatically.

Here is a quote from RosterFlat.java,

"// Try to load a roster from the 'old' style roster storage and
// convert it the the flat roster storage"

Right now PEP tries to retrieve the roster using the old style which is obsolete in the server code, and it fails consequently.

My personal preference is the old style, in which way buddy information can be queried by sql easily instead of parsing the xml every time. What's the advantage of saving it as an xml?

For the problem that PEP is

For the problem that PEP is not sent to the user's buddy, I found the following error log. It seems to look for a node with name 'roster' in tig_nodes table. However, I only see the entry in tig_pairs whose pkey is 'roster' in the database

2009-06-05 11:12:00 JDBCRepository.getNodeNID() FINEST: select nid as nid2, node as node2 from tig_nodes, (select nid as nid1 from tig_nodes where (uid = 5) AND (parent_nid is null) AND (node = 'root')) nodes1 where (parent_nid = nid1) AND (node = 'roster')
2009-06-05 11:12:00 JDBCRepository.getNodeNID() FINEST: Missing nid for node path: roster and uid: 5

In pubsub/repository/PubSubDao.java, I see the function

public String[] getUserRoster(String owner) throws RepositoryException {
try {
return this.repository.getSubnodes(owner, "roster");
} catch (Exception e) {
throw new RepositoryException("Getting user roster error", e);
}
}

Should the line

this.repository.getSubnodes(owner, "roster");

be changed to something like the following?

this.repository.getData(owner, "roster");

Thank you for the prompt

Thank you for the prompt reply. After changing my init.properties to exactly as you said, there is no more error response.

What if I have the cluster setting in init.properties like the following?

--comp-class-1 = tigase.pubsub.PubSubClusterComponent

What's the syntax for plugins-conf then? If I still use sess-man/plugins-conf/pubsub/pubsub-component = pubsub.vhost, then the client cannot login. The connection mananger's service got stopped somehow.

Another thing is that after the user publishes the tune, the same user receives that event back, but its
buddy (subscription both) does not seem to receive anything. And the database does not seem to be updated. When I tested pubsub, the database was updated with the new node.

Artur Hefczyc's picture

You need to activate both

You need to activate both PubSub component and PEP plugin for your Tigase installation. I am not sure whether PubSub component is loaded by default or not, but for sure PEP plugin is not. Here is an instruction how to activate both to make it all working. Edit your init.properties file and make sure there are lines as below:

# Activate the PubSub component
--comp-name-1 = pubsub
--comp-class-1 = tigase.pubsub.PubSubComponent
# Activate PubSub (PEP) plugin, note this works only
# since the last published version
--sm-plugins=+pubsub
# Redirect pep calls from PEP in session manager to 
# PubSub component.
# As a value put an address of your pubsub component.
# Normally this is: pubsub.yourdomain.com where
# yourdomain.com is a value of --virt-hosts property
sess-man/plugins-conf/pubsub/pubsub-component = pubsub.yourdomain.com

Stop the server, remove the XML configuration file and start the server. Please let me know if that helps.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.