Project

General

Profile

Is AMP loaded by default or by configuration

Matthew M
Added about 5 years ago

It's a little confusing in this doc: http://www.tigase.org/content/advanced-message-processing-amp-xep-0079

"It is enabled by default but there are several configuration options that you may tweak."

Do we have to add this line in init.properties in order to enable AMP, or it is by default enabled even without this line?

--sm-plugins=amp,-message,-msgoffline

Many thanks!


Replies (40)

Added by Wojciech Kapcia TigaseTeam about 5 years ago

No, you do no not need to add this line anymore - all necessary configurations to enable AMP are already there.

Added by Matthew M about 5 years ago

We have some trouble seeing AMP response stanza, so we tried with your tigase.im server, with PSI server, and sending this stanza, but there is no AMP response from tigase server, did we do anything wrong on the client side?

<message type="chat" to="user@tigase.im" id="aabfa">
<body>hi</body>
<amp xmlns='http://jabber.org/protocol/amp' status='alert' to="user@tigase.im">
    <rule action='alert' condition='deliver' value='none'/>
    <rule action='alert' condition='deliver' value='any'/>
  </amp>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>

We also tried any one of the above two rules, but it does not get any response either.

Thanks!

Added by Wojciech Kapcia TigaseTeam about 5 years ago

Hi,

as specification says:

The 'status' attribute specifies the reason for this element. When specifying semantics to be applied (client to server), this attribute MUST NOT be present. When replying to a sending entity regarding a met condition, this attribute MUST be present and SHOULD be the value of the 'action' attribute for the triggered rule. (Note: Individual action definitions MAY provide their own requirements.)

I've checked our installation with following example

<message type="chat" to="user@tigase.im">
<body>off_drop</body>
  <amp xmlns='http://jabber.org/protocol/amp'>
    <rule action='drop' condition='deliver' value='stored'/>
  </amp>
</message>

and it worked just fine - the message was simply dropped and not stored for offline delivery.

Added by Natale Vinto about 5 years ago

Hello,

I was wondering about the same issue, then I found this post.

I've a fresh Tigase-5.2.0-beta3-b3269 installation, running with default settings. While trying to use AMP, I cannot see it workings as XEP-0079 specs, and I'm trying to understand what I'm missing, since this last example posted is working for you.

I've sent this message to an offline user kingrichard:

<message id="kATrg-4" to="kingrichard@localhost" type="chat">
   <body>My lord, dispatch; read o&apos;er these articles.</body>
   <amp xmlns='http://jabber.org/protocol/amp'>
      <rule action='drop' condition='deliver' value='stored'/>
   </amp>
</message>

but the message is sent when the user kingrichard comes online again, and in logs I can see:

 [in_0-amp]         AmpComponent.matchCondition()      FINEST:   Matched condition: deliver, result: false
 [in_0-amp]         AmpComponent.processPacket()       FINEST:   Executing default action: deliver

I got the result=false always for any condition, I would drop messages that are invalidated by a certain timeout directly by the XMPP server, so I tried the example from specs, something like:

<rule condition='expire-at' action='drop' value='2013-10-31T19:51:00.000+0100'/>"
<rule action='error' condition='match-resource' value='other'/>"

buy always got matchCondition false, and looking in the code, I cannot understand why, maybe a configuration issue.

My init.properties is:

--comp-class-1 = tigase.muc.MUCComponent
--virt-hosts = localhost
--user-db-uri = jdbc:derby:/Applications/Tigase-5.2.0-beta3-b3269/tigasedb
--user-db = derby
--admins = admin@localhost
--comp-name-5 = message-archive
--comp-name-4 = rest
--comp-name-3 = proxy
config-type = --gen-config-def
--comp-name-2 = pubsub
--comp-name-1 = muc
--cluster-mode = false
--sm-plugins = +message-archive-xep-0136,+jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,+basic-filter,+domain-filter,+pep,+zlib
--debug = server,db
--comp-class-5 = tigase.archive.MessageArchiveComponent
--comp-class-4 = tigase.http.rest.RestMessageReceiver
--comp-class-3 = tigase.socks5.Socks5ProxyComponent
--comp-class-2 = tigase.pubsub.PubSubComponent

It could be my 5.2.0 beta default installation misconfiguration? Maybe msgoffline conflict with AMP

Thanks

Added by Natale Vinto about 5 years ago

If I disable msgoffline, and enable archiving explicitly, users temporary offline don't get any message when they come online again.

I'm using the default derby db created with the script

Added by Wojciech Kapcia TigaseTeam about 5 years ago

both AMP and msgoffline are session manager plugins. If you take a look at How packets are processed by the SM and plugins it should be more clear why it's happening.

In princliple each plugin registers packets that it can process, and both amp and msgoffline are responsible for handling message stanza. In addition - they do it in paralell so each packet is processed both by amp and msgofffline hence even tho AMP would not store message for offline user it would be handle by the second plugin.

Added by Natale Vinto about 5 years ago

Thanks for clarification, now the message is delivered if the user comes online again and the date is before the one wrote in the condition :)

Added by Wojciech Kapcia TigaseTeam about 5 years ago

First of all: 2.2.3 Process Rules

At this step, the server processes the attached semantics. The server MUST process the rules serially, and in the order they are presented within the element. As soon as a rule's condition is met, processing ends with that action overriding the default action determined earlier (unless the action permits continued processing).

You have two rules, first one has action="drop" which in turn is defined as:

The "drop" action silently discards the message from any further delivery attempts and ensures that it is not placed into offline storage. The drop MUST NOT result in other responses.

thus there is no reply. Second rule is not applied.

Condition for matching resource works as well.

If you want a response then you should change action for the first item.

Added by Natale Vinto about 5 years ago

Yes thank you, I've put action="alert" in the first rule and the server is applying the second rule, thus the sender receive correctly a notification alert.

Alert comes when:

  • receiver is online and timestamp is expired

  • receiver come back online and timestamp is expired

according to specification Expire-at Rules the alert notification comes when the server try to deliver the message, and the triggered action should be the connection to the server itself. I was looking for a way to get the alert in a more real-time scenario, as timeout is expired, independently of the availability of the user at the specific timeout expired, but maybe this goal should be reached outside server complexity.

Thanks!

Added by Wojciech Kapcia TigaseTeam about 5 years ago

To clarify - you would like to receive alert about failed delivery upon reaching expiration time without waiting for the user to come back and verification whether the rule should be applied?

Added by Natale Vinto about 5 years ago

Exactly, is there any event I could handle in server classes for that?

Added by Matthew M about 5 years ago

Many thanks for the information.

We would like to have the sender receive some kind of ACK so that the sender knows that Tigase correctly receive the message stanza. This is one of the main reason we are exploring AMP.

So I wonder what would be the in the sender's message stanza, to have Tigase reply on each "received" message from the sender? I've tried various combination but could not get any a rely stanza from tigase.im .

<message type="chat" to="user@tigase.im" id="aabfa">
<body>hi</body>
<amp xmlns='http://jabber.org/protocol/amp' status='alert' to="user@tigase.im">
    <rule action='alert' condition='deliver' value='none'/>
  </amp>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>

I would if you could help to correct my message stanza so that it could get a reply stanza from Tigase, such as "message is delivered", or "message is not deliver"?

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 5 years ago

Actually, AMP is not for that. AMP is not for packet delivery confirmation. It is more like an API to define more complex rules who the server should behave depending on different conditions.

For Message delivery confirmation you should explore XEP-0198 - Stream management - fully supported by Tigase 5.2.0 Beta3 and our JaXMPP client side library. (and our Android messenger) This extension gives you a message delivery confirmation but only on a network connection between a client and the server. So basically you know if the packet (message) sent by one side reached the other side of TCP/IP connection. It does not say anything about the message delivery to a final recipient. For this, there is yet another extension which describes message delivery receipts between 2 end-points.

Please follow the topic: Message Delivery Receipts which discusses all the aspects of the message delivery confirmation and similar topics. It provides you a list of XEPs with specification for different extensions.

Added by Natale Vinto about 5 years ago

Hi guys, I was also joining AMP with receipts and everything is fine putting all in a message stanza, but I have a strange issue on Tigase (Tigase-5.2.0-beta3-b3269) with users:

I have a virtualhost configuration set up on localhost, and it looks like some user settings or some mapping for routing get damaged or something else, because when I try to send a message with an expired timeout with XEP-184 and XEP-0079:

<message id="6W8qd-4" to="kingrichard@localhost/Resource" type="chat">
  <body>My lord, dispatch; read o'er these articles.</body>
  <request xmlns="urn:xmpp:receipts"/>
  <amp xmlns="http://jabber.org/protocol/amp">
    <rule condition="expire-at" action="error" value="2013-11-6T14:50:00.000+0100"/>
    <rule action="error" condition="match-resource" value="other"/>
  </amp>
</message>

I got the correct answer if the Sender user is freshly created or with not many sends:

<message id="6W8qd-4" to="northumberland@localhost/Resource" from="kingrichard@localhost/Resource" type="error">
  <error code="500" type="MODIFY">
    <undefined-condition xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    <failed-rules xmlns="http://jabber.org/protocol/amp#errors">
      <rule/>
    </failed-rules>
  </error>
</message>

And it's well done (@Wojciech what about triggering timeout expiration without waiting for deliverer presence event?)

The problem seems to come when user is "old" or who have already sent couples messages with the same syntax, I got this uncorrect (I guess) answer:

The server send the message back to the sender, without any useful information about message delivering

<message id="abVIv-4" to="northumberland@localhost/Resource" from="localhost" type="chat">
  <body>My lord, dispatch; read o'er these articles.</body>
  <request xmlns="urn:xmpp:receipts"/>
  <amp xmlns="http://jabber.org/protocol/amp">
    <rule/>
  </amp>
</message>

and the Sender send a receipt to server (because is listening also for theese events)

<message id="abVIv-5" to="localhost">
  <received xmlns="urn:xmpp:receipts" id="abVIv-4"/>
</message>

It looks strange to me, because if I create a new user this problem won't come. In logs I saw the same informations, either for good and "bad" send, is there anything I could look for specifically in log files to retreive possibles anomalies in routing or db mapping?

Thanks

Bye

Added by Wojciech Kapcia TigaseTeam about 5 years ago

Natale Vinto wrote:

Exactly, is there any event I could handle in server classes for that?

There are some timers within Tigase. However processing of AMP messages is done in plugins, which in turn are tied to user session and using timed event's to perform validity check would cause a rather high performance hit (especially if all messages would have expiry time).

As for the second problem - could you please try adding "xmpp" to your debuggin configuration in @init.properties@?

Would it be possible to share full log excerpts for the whole processing of both types of messages (ok and failed)?

Added by Natale Vinto about 5 years ago

Sure, log is very verbose (FINEST) do you know which keyword I could grep in order to extract the useful information?

Added by Wojciech Kapcia TigaseTeam about 5 years ago

If you don't mind it would be more useful to have whole thing. Please archive it and provide a link (can be by mail if there are private information in the logs).

Added by Natale Vinto about 5 years ago

Sure, I've uploaded an archive with two full log containing the above described procedure, one for the "good" send, and the other one for the "bad" send. It is available from here

I have two virtualhost, localhost and sub.localhost which is just another hostname for 127.0.0.1

User northumberland get bad AMP response, like the message only pong back to him from server (before this issue was working fine).

User fresh_user get correct AMP response.

My init.properties contains default settings, plus:

--virt-hosts = localhost,sub.localhost
--debug = server,db, xmpp.impl, archive, xmpp

Many thanks for support

Added by Wojciech Kapcia TigaseTeam about 5 years ago

I looked at the log, the only distinction I've noticed is a call to retrieve data related to message-archive in the 'bad' case. Do you happen to use this component/plugin? Is it enabled in both cases?

Added by Natale Vinto about 5 years ago

Yes it is enabled in both case. Anyway I don't send any archive request to the server in the code.

Plugins loaded are those pasted in previous post, specifically:

--sm-plugins = +message-archive-xep-0136,+jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,+basic-filter,+domain-filter,+pep,+zlib

Should I disable it? I wonder why in that case messages are retrieved from message-archive..

Added by Wojciech Kapcia TigaseTeam about 5 years ago

Could you try to reproduce the issue with a stripped-down version of config, i.e removed not needed components and using default plugins list (which would use AMP by default)? Something along the lines of:

--virt-hosts = localhost
--user-db-uri = jdbc:derby:/Applications/Tigase-5.2.0-beta3-b3269/tigasedb
--user-db = derby
--admins = admin@localhost
config-type = --gen-config-def
--cluster-mode = false
--debug = server,db

Added by Natale Vinto about 5 years ago

Hi,

to reproduce the issue I should add the other virtualhost "sub.localhost", is ok for the test?

Added by Natale Vinto about 5 years ago

ok

Added by Wojciech Kapcia TigaseTeam about 5 years ago

yes.

Added by Natale Vinto about 5 years ago

Hi Wojciech,

same issue with the new configuration. Maybe because the information is "corrupted" for that user, but I cannot reproduce the issue in a deterministic way. What I do, having two entities connected, is:

sender:

  • connect with full JID

  • ask subscription

  • send AMP message

receiver:

  • connect with full JID

  • accept subscription

(1-25/40)