Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Page:  1  2  next
Avatar
Joeri #1
Member since Jul 2006 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: PubSubManager
Hi,

I'm trying to figure out how to make the PubSubManager work. Is there any code snippet or example available that could demonstrate how the library is to be used?

thx in advance

beste regards
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

on the download page you can also download some samples. The PubsubManager is used like the other Manager classes for Presence or Muc. The Manager classes are Helper classes you let you build complex packages pretty easy. Normally in one line of code.

Here is a small sample for the MucManager for joining a chat room
  1. MucManager mucManager = new MucManager(m_XMPPClient);
  2. mucManager.JoinRoom(roomJid, "room");

Alex
Avatar
Rotjoeng #3
Member since Jul 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Hi,

We're trying to add a collectionnode to a collection node. Therefore we have to specify the configuration (<configure>) when we create a new collectionnode.

Is there a way to specify this configuration? The pubsubmanager only asks for a defaultconfiguration or none.

Filip
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

thats not possible at the moment with the PubSub Manager. You have to derive from the Pubsubmanager and add a new overload which accepts a configuration.
We can add this with the next version if this is a requested and important feature. We had not many feedbacks yet about the pubsub stuff. There are not many people working with pubsub yet, and pubsub in wildfire is pretty new.

Alex
Avatar
Rotjoeng #5
Member since Jul 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
I've overloaded your CreateCollectionNode.
If you want  I can send it to you.
Avatar
Jabberer #6
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hi,

you can post your overloaded Member here in the forums. We will check it and include it with the next SVN commit to the code.
Software Developer
AG-Software
Avatar
Rotjoeng #7
Member since Jul 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
new :

  1. public void CreateNode(Jid to, string node, Configure config, IqCB cb)
  2.         {
  3.             CreateNode(to, null, node, config, cb, null);
  4.         }
  5.  
  6. public void CreateCollectionNode(Jid to, string node, Configure config, IqCB cb)
  7.         {
  8.             CreateCollectionNode(to, null, node, config, cb, null);
  9.         }
  10.  
  11.  public void CreateNode(Jid to, Jid from, string node, Configure config, IqCB cb, object cbArgs)
  12.         {
  13.             CreateAbstractNode(to, from, node, config, cb, cbArgs, false);
  14.         }
  15.  
  16. public void CreateCollectionNode(Jid to, Jid from, string node, Configure config, IqCB cb, object cbArgs)
  17.         {
  18.             CreateAbstractNode(to, from, node, config, cb, cbArgs, true);
  19.         }
  20.  
  21.  
  22. public void CreateAbstractNode(Jid to, Jid from, string node, bool defaultConfig, IqCB cb, object cbArgs, bool isCollection)
  23.         {
  24.             Configure config = null;
  25.             if (defaultConfig)
  26.                 config = new Configure();
  27.  
  28.             CreateAbstractNode(to, from, node, config, cb, cbArgs, isCollection);
  29.         }
  30.  
  31.         public void CreateAbstractNode(Jid to, Jid from, string node, Configure config, IqCB cb, object cbArgs, bool isCollection)
  32.         {
  33.             PubSubIq pubsubIq = new PubSubIq(IqType.set, to);
  34.  
  35.             if (from != null)
  36.                 pubsubIq.From = from;
  37.  
  38.             if (isCollection)
  39.                 pubsubIq.PubSub.Create = new Create(node, Type.collection);
  40.             else
  41.                 pubsubIq.PubSub.Create = new Create(node);
  42.  
  43.             if (config != null)
  44.                 pubsubIq.PubSub.Configure = config;
  45.  
  46.             if (cb == null)
  47.                 m_connection.Send(pubsubIq);
  48.             else
  49.                 m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs);
  50.         }

changed:

  1.  public void CreateNode(Jid to, Jid from, string node, bool defaultConfig, IqCB cb, object cbArgs)
  2.         {
  3.             CreateAbstractNode(to, from, node, defaultConfig, cb, cbArgs, false);
  4.         }
  5.  
  6. public void CreateCollectionNode(Jid to, Jid from, string node, bool defaultConfig, IqCB cb, object cbArgs)
  7.         {
  8.             CreateAbstractNode(to, from, node, defaultConfig, cb, cbArgs, true);
  9.         }

If you have any remarks, plz post them
This post was edited 2 times, last on 2006-07-20, 12:26 by Jabberer.
Avatar
Rotjoeng #8
Member since Jul 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Hi,

it's me again

when i try to publish an item i keep on getting this error! again!

The node i'm sending to is a leaf and i'm the owner.



Example 98. Publisher attempts to publish to transient notification node with item
<iq type='error'
    from='pubsub.shakespeare.lit'
    to='hamlet@denmark.lit/elsinore'
    id='publish1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='princely_musings'>
      <item id='ae890ac52d0df67ed7cfdf51b644e901'/>
    </publish>
  </pubsub>
  <error type='modify'>
    <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    <item-forbidden xmlns='http://jabber.org/protocol/pubsub#errors'/>
  </error>
</iq>
Avatar
Alex #9
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

can you post your XML debug log and you code?
Which server or pubsub component are you using?

Alex
Avatar
Rotjoeng #10
Member since Jul 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
debug

SEND:
<iq xmlns="jabber:client" id="agsXMPP_27" type="set" to="pubsub.xxx.be" from="filip@xxx.be">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="/Zembla/Benny/test2">
<item id="filip/101" />
</publish>
</pubsub>
</iq>
RECV: <iq xmlns="jabber:client" from="pubsub.xxx.be" to="filip@xxx.be/agsXMPP" type="error" id="agsXMPP_27">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="/Zembla/Benny/test2">
<item id="filip/101" />
</publish>
</pubsub>
<error code="400" type="modify">
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
<item-forbidden xmlns="http://jabber.org/protocol/pubsub#errors" />
</error>
</iq>

Code
Public Sub PublishItem(ByVal extension As String, ByVal node As String)
        Dim item As New agsXMPP.protocol.extensions.pubsub.Item(m_connection.MyJID.User & "/" & extension)
        m_pubSubManager.PublishItem(m_pubSubJid, New Jid(m_connection.MyJID.Bare), node, item, AddressOf PublishItemItemResultIq)
End Sub


We are using Wildfire, Version: 3.0.0

Mybe this could help
Some info about the node:

pubsub - leaf
FORM_TYPE - http://jabber.org/protocol/pubsub#meta-data
pubsub#title -
pubsub#description -
pubsub#subscribe - 1
pubsub#subscription_required - 0
pubsub#deliver_payloads - 0
pubsub#notify_config - 1
pubsub#notify_delete - 1
pubsub#notify_retract - 1
pubsub#presence_based_delivery - 0
pubsub#type -
pubsub#body_xslt -
pubsub#dataform_xslt -
pubsub#access_model - open
pubsub#publish_model - open
pubsub#language - English
pubsub#owner - filip@xxx.be
pubsub#itemreply - owner
pubsub#send_item_subscribe - 1
pubsub#persist_items - 0
pubsub#max_items - 1
pubsub#max_payload_size - 5120"
This post was edited on 2006-07-20, 17:39 by Rotjoeng.
Avatar
Alex #11
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

this looks of to me if the collection nodes and leaf is setup correctly.
Did you try it with another ItemID? its possible that there is a conflict because your item id contains a slash.
If it still does't work you could try to post in the wildfire forums. I tried to talk to a wilfire developer, but i haven't seen them yet online today.

Alex
Avatar
Alex #12
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
from the Jive Source code:

// Check that no item was included if node doesn't persist items and doesn't
// includes payload
if (itemElements.hasNext() && !leafNode.isItemRequired()) {
   Element pubsubError = DocumentHelper.createElement(QName.get(
                   "item-forbidden", "http://jabber.org/protocol/pubsub#errors"));
   sendErrorPacket(iq, PacketError.Condition.bad_request, pubsubError);
   return;
}

You are getting this error because your node configuration is wrong.
The node is not persisting items AND it is not delivering payloads.

Alex
Avatar
Rotjoeng #13
Member since Jul 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Hi,

It's me again..

I'm able to publish and retracht items from a node. I don't know if it's possible to adjust an item. When I publish an item with an existing id it autogenerates an id for this new item.
I read the JEP-60 but i don't find anything about adjusting an item.
The only workaround i can think of is first retract and then add it as a new one. But this is too time-consuming.

Maybe you'll are to help me with this.

Filip


EDIT: NEVER MIND
This post was edited on 2006-07-24, 14:08 by Rotjoeng.
Avatar
Alex #14
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hello,

its not possible to edit an published item. Pubsub only supports publishing and deleting items.
Let us know how ou solved it.

Alex
Avatar
Rotjoeng #15
Member since Jul 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Hi,

Yes I found out to that it's impossible. But it was a misunderstanding about our structure. Items didn't have to be edited, just published and deleted.

So there's no problem anymore..

But again, thx for the quick response.

Filip
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next
Forum: agsXMPP RSS