7.1 AbandonRequest

This request is used to tell the server that a given request (sent previously) has been abandoned. The only required parameter is the ID field of a request you want to stop.

    public interface AbandonRequest extends Request
    {
        /**
         * Gets the id of the request operation to terminate.
         * 
         * @return the id of the request message to abandon
         */
        int getAbandoned();


        /**
         * Sets the id of the request operation to terminate.
         * 
         * @param requestId the sequence id of the request message to abandon
         * @return The AbandonRequest instance
         */
        AbandonRequest setAbandoned( int requestId );
    }

There are two existing implementations that can used:

  • AbandonRequestImpl : The default implementation.
  • AbandonRequestDsml : An implementation used when you want to generate a DSML request

The AbandonRequest message does not have a response, the abandonned request will just be stopped.

Usage

It’s pretty easy to do. You just to inject the ID of the request you want to abandon:

    connection.abandon( messageId );

This will interrupt the request whose ID equals messageId.

Adding some controls

You can add a control in the AbandonRequest, once you create an instance of AbandonRequestImpl:

    AbandonRequest abandonRequest = new AbandonRequestImpl( messageId );

    // Add your control 
    abandonRequest.addControl( control );

    // Send the request
    connection.abandon( abandonRequest );