-
| Correlation requires some extra care; in fact there is a common use case that cannot managed by the current state of the spec. Furthermore, those interactions are asynchronous: the external system emits a message with that specific correlation id, so that message must be routed to workflow instance who initiated the communication. sequenceDiagram
    autonumber
    workflow ->>external system: new interaction
    external system-->>workflow: new correlation id
    activate external system
    external system->>workflow: deferred response (new correlation id)
The previous use case cannot be modeled with current spec capabilities, because it's not possible to define a new correlation id (context attribute) based on the function response. - name: New interaction
  type: operation
  actions:
    - name: New interaction
      functionRef:
        refName: call
      correlationDataFilter:
        results: '${ .sessionId }'
        toContextAttributeName: externalSystemIDAnother important aspect is related to the communication protocol: the external system need to know also the address where to send the deferred response. For example in case of an http protocol along with the message  | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
| Firstly, it seems like you're using a DSL version earlier than  Secondly, I'm not entirely sure I understand the challenges you're facing, as the specification is designed to support dynamic and externally defined correlation IDs. Here's how your example can be modeled: 1. Storing a Dynamic Correlation IDAfter a task completes, you can store the response in the workflow context using the  - newInteraction:
    call: http
    with:
      method: get
      endpoint: https://someendpoint.com
    export:
      as: '$context + { externalSystemId: .result.correlationId }'2. Correlating Future Events:When listening for events, you can correlate them based on this stored value: - consumeEvent:
    listen:
      to:
        one:
          with:
            type: com.example.type.v1
            source: https://example.source.com
          correlate:
            - myDynamicKey:
                from: '$context.externalSystemId'
 Currently, there is no built-in way to support webhook-style callbacks, as it would require workflow runtimes to handle per-instance servers for all protocols. To implement similar functionality, you should rely on CloudEvents, which facilitate asynchronous processes effectively. | 
Beta Was this translation helpful? Give feedback.
Firstly, it seems like you're using a DSL version earlier than
1.0.0. If that's the case, please consider upgrading to version1.0.0-alpha1and later, as older versions are being discontinued.Secondly, I'm not entirely sure I understand the challenges you're facing, as the specification is designed to support dynamic and externally defined correlation IDs.
Here's how your example can be modeled:
1. Storing a Dynamic Correlation ID
After a task completes, you can store the response in the workflow context using the
exportfeature: