Using RouteRules, send a subset of API requests to TargetEndpoint 1 and others to TargetEndpoint two.

Not applicable

Using RouteRules, send a subset of API requests to TargetEndpoint 1 and others to TargetEndpoint two.

0 6 400
6 REPLIES 6

Please refer here

@Remeesh , Thank you for chipping in & answering questions in community. Please avoid one line answers with links. Be more descriptive to answer questions so that it will be helpful for others & crawlers too 🙂

PS: This comment will be visible only to you & moderators. It's not public.

Sure, thanks for the suggestions.

Not applicable

Thanks for the answer. It was really helpful.

It answer my question partial . I have a scenario where we have to do content base routing dynamically, based on the content coming from the client.

Basically client wants to revert data from two different Vendors(Providers).

For example. Client want to revert the status of delivery of his goods from UPS, USPS and Fed Ex.

If the "carrier ID" element in message payload says FedEx, then we have to dynamically route to FedEx to retrieve the delivery status of goods.

Hi @Baijunath Allam It's very similar to the approach @Remeesh suggested. You basically define multiple routing rules pointing them to your target backends. In your request pipeline have an extract variable policy to extract Carrier ID field from the request message and use that variable in the condition tag.

For eg -

<RouteRule name="FedExRoute">
  <Condition>carrierID = "FedEx"</Condition>
  <TargetEndpoint>FedExTarget</TargetEndpoint>
</RouteRule>
<RouteRule name="UPSRoute">
  <Condition>carrierID = "UPS"</Condition>
  <TargetEndpoint>UPSTarget</TargetEndpoint>
</RouteRule>
<RouteRule name="default">
 <TargetEndpoint>defaultTarget</TargetEndpoint>
</RouteRule>

Hope it helps!

Not applicable

First you have to extract the carrier ID(From Request Payload using Extract Variable) and use that in your route rules as condition to route to the respective targetEndPoint. Same can be achieved using JavaScript also.