Is there an API to check if a workflow id is available

hi Team,

We are using java-sdk (1.17.0) and we are setting the workflow id based on the incoming request.
These workflow id are unique. We are using WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE.
But there is a scenario, where we might receive concurrent duplicate requests which causes one of the request to proceed and causing failures for other requests. Ideally, we would like to process all these requests.

Is there any API to find out if an id is avaliable for use based on the policy set.

Yes, this API is starting workflow with WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE. If start is not possible, then you get the ALREADY_STARTED exception back.

If you need to process all requests but ensure that they are executed one by one, then I would recommend using SignalWithStart and looping over signals inside the workflow implementation.