Bypassing Shared Flow attached via Flow Hooks

sydub7
New Member

While Flow Hooks provides great help in implementing common functionality across all proxies in the enviornment. Should a need arise, is there a way to by pass it on a particular proxy ?

Solved Solved
3 2 925
1 ACCEPTED SOLUTION

Hmmmm, yes, and when you see it.....

A common practice is to include a lookup in a KVM into the SharedFlow, and then include a conditional in the SharedFlow to gate the execution of selected policies. For example, the SharedFlow might look like this:

<SharedFlow name="mysharedflow">
    <Step>
        <Name>KVM-GetSkipExecute</Name>
    </Step>
    <Step>
        <Condition>skip_mysharedflow = null</Condition>
        <Name>AdditionalStep1</Name>
    </Step>
    <Step>
        <Condition>skip_mysharedflow = null</Condition>
        <Name>AdditionalStep2</Name>
    </Step>
    ...

And the KVM policy is something like this:

<KeyValueMapOperations name="KVM-GetSkipExecute" mapIdentifier="settings">
    <ExpiryTimeInSecs>30</ExpiryTimeInSecs>
    <Get assignTo="skip_mysharedflow">
        <Key>
            <Parameter>skip-mysharedflow</Parameter>
            <Parameter ref="apiproxy.name"/>
        </Key>
    </Get>
    <Scope>environment</Scope>
</KeyValueMapOperations>

The result of the KVM lookup will be different for each apiproxy in the environment.

To skip the SF for "proxy1", The settings map needs to have an entry with

key: skip-mysharedflow__proxy1

value: true

Actually the value can be anything non-null. You can have multiple elements in the settings map, one for each named proxy.

To "not skip" the SF, delete the appropriate entry in the KVM for that apiproxy.

Does this make sense?

View solution in original post

2 REPLIES 2

Hmmmm, yes, and when you see it.....

A common practice is to include a lookup in a KVM into the SharedFlow, and then include a conditional in the SharedFlow to gate the execution of selected policies. For example, the SharedFlow might look like this:

<SharedFlow name="mysharedflow">
    <Step>
        <Name>KVM-GetSkipExecute</Name>
    </Step>
    <Step>
        <Condition>skip_mysharedflow = null</Condition>
        <Name>AdditionalStep1</Name>
    </Step>
    <Step>
        <Condition>skip_mysharedflow = null</Condition>
        <Name>AdditionalStep2</Name>
    </Step>
    ...

And the KVM policy is something like this:

<KeyValueMapOperations name="KVM-GetSkipExecute" mapIdentifier="settings">
    <ExpiryTimeInSecs>30</ExpiryTimeInSecs>
    <Get assignTo="skip_mysharedflow">
        <Key>
            <Parameter>skip-mysharedflow</Parameter>
            <Parameter ref="apiproxy.name"/>
        </Key>
    </Get>
    <Scope>environment</Scope>
</KeyValueMapOperations>

The result of the KVM lookup will be different for each apiproxy in the environment.

To skip the SF for "proxy1", The settings map needs to have an entry with

key: skip-mysharedflow__proxy1

value: true

Actually the value can be anything non-null. You can have multiple elements in the settings map, one for each named proxy.

To "not skip" the SF, delete the appropriate entry in the KVM for that apiproxy.

Does this make sense?

Wow !!! I like your approach and it make perfect sense to me. I shall try a small POC in couple of days and share the results with you. Thank you for providing directions 🙂