[jdev] Cancelling an iq query
Ralph Meijer
jabber.org at ralphm.ik.nu
Tue Aug 30 03:10:15 CDT 2005
On Mon, Aug 29, 2005 at 03:00:42PM -0700, Ralph Giles wrote:
> On Mon, Aug 29, 2005 at 08:39:33PM +0200, Ralph Meijer wrote:
> [..]
>
> > Sure, you could use JEP-0050 for that, but that wasn't the complete
> > problem of the other Ralph. He wanted to be able to cancel a placed
> > request *and* still receive results asynchronously. Or do you propose
> > not replying to the original <iq/> until the request has indeed been
> > completed or cancelled?
>
> Actually, that would work for us. It's nice having teh query
> sanity-checked, but the important thing is to be able to cancel
> and/or modify. It's fine if the reply comes back either when
> the results are available, or after the ad hoc cancel command
> has killed the query.
>
> I'm not clear that it's ligher weight than the transaction
> semantics though...
Ok, JEP-0050 adds some extra processing. I might now be tempted to
do the following:
Request:
<iq from='client at example.com/client'
to='service.example.com'
type='set' id='H_2'>
<transaction xmlns='http://example.com/transaction'>
<query id='query_5'>
...
</query>
</transaction>
</iq>
Response when not cancelled, no need for the actual query identifier:
<iq from='service.example.com'
to='client at example.com/client'
type='result' id='H_2'>
<transaction xmlns='http://example.com/transaction'>
<results>
...
</results>
</transaction>
</iq>
Cancel request:
<iq from='client at example.com/client'
to='service.example.com'
type='set' id='H_3'>
<transaction xmlns='http://example.com/transaction'>
<cancel id='query_5'/>
</transaction>
</iq>
Yielding:
<iq from='service.example.com'
to='client at example.com/client'
type='result' id='H_3'/>
<iq from='service.example.com'
to='client at example.com/client'
type='error' id='H_2'>
<transaction xmlns='http://example.com/transaction'>
<query id='query_5'>
...
</query>
</transaction>
<error type='cancel'>
<undefined-condition xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<cancelled xmlns='http://example.com/transaction#error'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>
The referenced query has been cancelled.
</text>
</error>
</iq>
or in case the request already finished; the H_2 reply is then as above,
in the happy path:
<iq from='service.example.com'
to='client at example.com/client'
type='error' id='H_3'>
<transaction xmlns='http://example.com/transaction'>
<cancel id='query_5'/>
</transaction>
<error type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<completed xmlns='http://example.com/transaction#error'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>
The referenced query has already been completed and cannot be
cancelled.
</text>
</error>
</iq>
--
Groetjes,
ralphm
More information about the JDev
mailing list