Start of Content Area

Procedure documentation Guaranteeing Exactly Once In Order  Locate the document in its SAP Library structure

Use

Exactly Once in Order is a quality of service that ensures that asynchronous messages arrive in exactly the same order at the receiver as they were sent from the sender. You can give an asynchronous client proxy a serialization context. The serialization context is a string with a maximum length of 16 characters (only upper-case letters and figures are permitted). All messages with the same string then arrive at the receiver in the sequence in which they were sent.

Note

You must use naming conventions to ensure that two different components always use different serialization contexts.

Procedure

In the example below, an asynchronous message is sent with the serialization context PLM0000007_ORDER:

...

DATA:

* Reference variables for proxy and exception class
  lo_clientProxy     TYPE REF TO [Generated Proxy Class],
  lo_sys_exception   TYPE REF TO cx_ai_system_fault,
  lo_async_messaging TYPE REF TO if_wsprotocol_async_messaging.

* Structures to set and get message content
   ls_request         TYPE [Output Message Type],

* create proxy client

    CREATE OBJECT lo_clientProxy.

* specify queue id

    lo_async_messaging ?=
      lo_clientProxy->get_protocol( if_wsprotocol=>async_messaging ).

    lo_async_messaging->set_serialization_context('PLM0000007_ORDER').

* do asynchronous client proxy call

    CALL METHOD lo_clientProxy->execute_asynchronous
             EXPORTING output  = ls_request.

    COMMIT WORK.

    CATCH cx_ai_system_fault INTO lo_sys_exception.

*   Error handling

ENDTRY.

Note

You can query a serialization context that has been set by using the method GET_SERIALIZATION_CONTEXT.

 

 

 

 

 

 

End of Content Area