Hi.
My team has that scenario implemented (quite a lot of times actually).
We tipically apply two different solutions (according to the requirements, and both are similar to what Miroslav wrote):
1 - Use the underline datapower capabilities, and create a mapping/routing file in the DataPower system. This routing file could be directly acessed via Gateway script in the API code to decide and retrive the destination URL. Drawback: you will have to maintain the file locally, and if you several machines, you might need to implement a process to maintain that file synced betwwen gateways (we use a jenkins pipeline, but ti can also be done manually. I do not recomend the manual solution)
2 - Use an external system to maintain the routing information. We use an internal BRM (Bussiness Rules System) that maintain that information. Advantage: we have only one place to update the information (and our BRM solution has a very nice GUI standard interface that helps editing the information. Drawback: is one more call from the API to an external system (although this can/must be minimize by the use of the cache feature in the API Invoke)
Hope it helps
------------------------------
Tiago Soares
------------------------------
Original Message:
Sent: Thu December 30, 2021 04:22 AM
From: Mohd Ahmed Siddiqui
Subject: How to call multiple external consumers dynamically
Dear Miro,
Thanks a lot for your valuable suggestion.
Let me try it and get you back.
Regards,
Ahmed
------------------------------
Mohd Ahmed Siddiqui Senior Integration Developer
Senior Integration Developer
Tabadul
Riyadh
+966-558642861
------------------------------
Original Message:
Sent: Thu December 30, 2021 03:35 AM
From: Miroslav Rešetar
Subject: How to call multiple external consumers dynamically
Dear Mohammed,
By invoking "different consumers" I think you've meant different API providers.
Consumers will invoke API Connect as API connect will provide end API.
From the APIs themselves, you can invoke external APIs which might have different URLs and
security constraints.
As you know, we have Invoke policy which you might use to invoke external APIs.
You would need some kind of routing table so you can route dynamically. You can hard
code routing table in the definition of the API (assembly) or use external source as a routing table.
One easy solution would be to host static JSON, it could be even exposed as API on APIC.
This JSON would you then use to route request when you recognize to which
service it should go. If you need to route by "incoming id" then it looks like
you would need to do some DB lookup. So you would build a service that would do the lookup
(in Java for example) and use the service to return Endpoint address and security constraints.
With this information, you could then build an appropriate request and call an external API.
I hope this helps.
All the best,
Miro
------------------------------
Miroslav Rešetar
CROZ d.o.o.
Zagreb