Skip to main content

Enabling the default Correlation ID policy

The default correlation ID feature provides two options:

  • Use of the custom correlation ID using a callback.

  • Use of the custom correlation ID generated.

For more information on how to use these options, see the procedure below:

  1. Make sure the Talend Runtime is running, and the Service Registry service has been started. For more information, see the Talend ESB Container Administration Guide.

  2. Import the correlation ID policy to the Service Registry, either directly from the Talend Runtime. For more information, see Using the Service Registry with Talend ESB or via the Talend Administration Center, for more information, see the Talend Administration Center User Guide.

    Talend ESB provides a template policy called wspolicy_correlation_id.policy and available in the /add-ons/registry/policies folder of the Talend ESB product.

    <wsp:Policy Name="wspolicy_schema_correlation_id" 
                xmlns:wsp="http://www.w3.org/ns/ws-policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <tpa:CorrelationID 
                xmlns:tpa="http://types.talend.com/policy/assertion/1.0" 
                type="callback" />
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>

    In this default example, the callback option is used: type="callback".

    But if you want to automatically generate the correlation ID, remove the type="callback" attribute and value from the policy, then the id will be generated automatically as system UID, and the value will be the same for request and response.

    Example of Correlation ID policy without the callback option:
    <wsp:Policy Name="wspolicy_schema_correlation_id" xmlns:wsp="http://www.w3.org/ns/ws-policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <tpa:CorrelationID xmlns:tpa="http://types.talend.com/policy/assertion/1.0" type="callback"/>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
  3. If you use the callback option, you should specify the correlation ID callback handler that will produce your custom correlation ID:

    <jaxws:properties>
      <entry key="correlation-id.callback-handler">
        <bean class="common.talend.CorrelationHandler" />
      </entry>
    </jaxws:properties>

    Where common.talend.CorrelationHandler is a custom class that implements the org.talend.esb.policy.correlation.CorrelationIDCallbackHandler interface. You need to create the class and change the name of the class to your own in the code above appropriately.

  4. Assign the policy to the service which you want to enable the Correlation ID feature.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!