Interface CorrelationActivity


  • public interface CorrelationActivity
    Activity used to request and receive asynchronously queried correlation data.

    Asynchronous requests

    The procedure to send asynchronous requests is:

    1. create the activity using the CorrelationProvider.createActivity() method
    2. get an ActivityContextInterface object for the activity
    3. attach the SBB local object to the ACI
    4. send the request using the requestCorrelationData(String) method on the activity
    5. handle the result in an event handler for the CorrelationResultEvent event
    6. handle failures in an event handler for the CorrelationFailureEvent event

    Example asynchronous request

         private void asyncRequest(String correlationId) {
             try {
                 CorrelationActivity corrActivity = corrProvider.createActivity();
                 ActivityContextInterface corrAci = corrACIFactory.getActivityContextInterface(corrActivity);
                 corrAci.attach(getSbbLocalObject());
                 corrActivity.requestCorrelationData(correlationId);
             }
             catch (StartActivityException e) {
                 // ... handle exception ...
             }
         }
         public void onCorrelationResult(CorrelationResultEvent result, ActivityContextInterface aci) {
             aci.detach(getSbbLocalObject());
             byte [] corrData = result.getCorrelationData()
             // ... do something with the data ...
         }
         public void onCorrelationFailure(CorrelationFailureEvent failure, ActivityContextInterface aci) {
             aci.detach(getSbbLocalObject());
             // ... handle failure ...
         }
     
    • Method Detail

      • requestCorrelationData

        void requestCorrelationData​(String correlationId)
        Request the correlation data associated with the specified Correlation ID.

        The result will be fired as a CorrelationResultEvent event on this activity. Failed queries will be fired as a CorrelationFailureEvent.

        Parameters:
        correlationId - the Correlation ID.
      • peekCorrelationData

        void peekCorrelationData​(String correlationId)
        Request the correlation data associated with the specified Correlation ID.
        Unlike requestCorrelationData(String) this will not remove the stored data. This means that the correlation ID will only be released if

        The result will be fired as a CorrelationResultEvent event on this activity. Failed queries will be fired as a CorrelationFailureEvent.

        Parameters:
        correlationId - the Correlation ID.