Projects tigase _server server-core Issues #297
Custom packet formation (#297)
Ali Saleem opened 1 decade ago

When i add new attributes or append new child in packet from Message.java. If session is null, then packet goes to offlineMessage.java, but custom attributes or custom children that were added in packet in "Message.java" are no longer present in the packet.

For example, this is my custom packet created in Message.java

<message xmlns="jabber:client" to="123:testingmine@muc.app.abc.xyz" 
        type="groupchat" from="567@app.abc.xyz/Smack" id="104" custom_attr = "custom_value" >
    <body>This is my message</body>
          <properties xmlns="http://www.jivesoftware.com/xmlns/xmpp/properties">
              <property>
                  <name>role</name>
                  <value type="string">visitor</value>
              </property>
          </properties>
          <CustomChild>
                value of customChild 
          </CustomChild>
   </body>
</message>

Packet which i received in OfflineMessage.java is as follow.

<message xmlns="jabber:client" to="123:testingmine@muc.app.abc.xyz" type="groupchat" from="567@app.abc.xyz/Smack" id="104" >
    <body>This is my message</body>
          <properties xmlns="http://www.jivesoftware.com/xmlns/xmpp/properties">
              <property>
                  <name>role</name>
                  <value type="string">visitor</value>
              </property>
          </properties>
   </body>
</message>
wojciech.kapcia@tigase.net commented 1 decade ago

This behaviour is expected and is a result of design. If you take a look at How packets are processed by the SM and plugins you can notice following:

There might be also more than one plugin for a specific XML element and then they all process the same stanza simultaneously in separate threads so there is no guarantee on the order in which the stanza is processed by a different plugins.

and

It is also important to note that session manager and processor plugins act as packet consumers. The packet is taken for processing and once processing is finished the packet is destroyed. Therefore to forward a packet to a destination one of the processor must create a copy of the packet, set all properties and attributes and return it as a processing result.

issue 1 of 1
Type
Task
Priority
Major
Assignee
RedmineID
1781
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#297
Please wait...
Page is in error, reload to recover