invoke flow hook on a condition flow

Hi, Here is my use case.

I am creating a token using a flow hook and storing it in the cache. I have to validate whether the token is expired or not when API is called. If the token is expired I need to invoke the flow hook to generate a token and store in the cache.

Can you please help me with this ?

Thanks in advnace !!

0 3 190
3 REPLIES 3

Let's be careful about terminology.

shared flow = a re-usable sequence of policy steps

Flow hook = a way to enforce the invocation of a shared flow

I think you want to invoke a Shared Flow (not a flow hook).

the logical sequence is probably somehrting like:

  • try to load token from cache
  • if no token in cache, get one
  • if expired, invoke shared flow to get new token
  • ...???
  • profit!

And I guess you probably can make your way through all of that? It looks something like this:

<Step> 
  <Name>LookupCache-1</Name> 
</Step>
<Step>
  <Name>FC-ObtainAndCacheToken</Name>
  <Condition>retrieved_token = null</Condition>
</Step>
<Step> 
  <Name>CheckExpiry-1</Name> 
</Step>
<Step>
  <Name>FC-ObtainAndCacheToken</Name>
  <Condition>retrieved_token.expired = true</Condition>
</Step>

Thanks for the response. Actually I pass values to jar file(shared flow) from KVM to generate a token, so when I invoke the KVM when the cache is null or expired does it invoke the next step i.e does shared flow invoke as the next step after we invoke KVM ?

I'm not clear. "Does it invoke the next step?"

The Flow proceeds with each step. If you have a Condition on a step, then the flow may skip that step, depending on the evaluated value of the Condition.

I may be misunderstanding your question.