Skip to content

Commit ea92c66

Browse files
Separate approaches
1 parent 05e3bd3 commit ea92c66

File tree

3 files changed

+365
-60
lines changed

3 files changed

+365
-60
lines changed

docs-java/environments/kyma.mdx

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ The official [documentation of the Transparent Proxy](https://help.sap.com/docs/
586586

587587
You can either configure connectivity to individual destinations, or for arbitrary destinations in your destination service instance or subaccount (via Destination Gateway).
588588

589-
<Tabs
589+
<Tabs
590590
groupId="dynamic-dest"
591591
defaultValue="single"
592592
values={[
@@ -659,9 +659,22 @@ Apply the YAML with `kubectl apply -n` into the namespace of your application po
659659

660660
### Executing Requests
661661

662-
In your application you can now configure a destination to execute requests:
662+
The SAP Cloud SDK offers two distinct approaches for executing requests through the Transparent Proxy in Kyma. Choose the approach that best fits your application's architecture and requirements.
663663

664-
<Tabs
664+
## Approach 1: TransparentProxyDestination Builder (Recommended)
665+
666+
The **TransparentProxyDestination Builder** approach provides explicit, fine-grained control over individual destination configurations. This is the recommended approach for most use cases as it offers maximum flexibility and clear configuration management.
667+
668+
### When to Use This Approach
669+
670+
- You need specific control over individual destination configurations
671+
- You want to set custom headers or properties per destination
672+
- You prefer explicit destination management
673+
- You want to consume a destination with fragment or chain
674+
675+
### Implementation Examples
676+
677+
<Tabs
665678
groupId="dynamic-dest"
666679
defaultValue="single"
667680
values={[
@@ -670,6 +683,10 @@ In your application you can now configure a destination to execute requests:
670683
]}>
671684
<TabItem value="single">
672685

686+
**For Concrete SAP Destinations:**
687+
688+
Use this when connecting to a specific, pre-configured destination with a dedicated Destination Custom Resource.
689+
673690
```java
674691
TransparentProxyDestination destination = TransparentProxyDestination
675692
.destination(<destination-custom-resource-name>.<destination-custom-resource-namespace>)
@@ -684,6 +701,10 @@ List<SalesArea> execute = new DefaultSalesAreaService().getAllSalesArea() // exa
684701
</TabItem>
685702
<TabItem value="gateway">
686703

704+
**For Gateway:**
705+
706+
Use this when you need to connect to arbitrary destinations dynamically using a [Gateway Destination Custom Resource](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations).
707+
687708
```java
688709
TransparentProxyDestination destination = TransparentProxyDestination
689710
.gateway("my-destination", <destination-custom-resource-name>.<destination-custom-resource-namespace>)
@@ -701,11 +722,54 @@ List<SalesArea> execute = new DefaultSalesAreaService().getAllSalesArea() // exa
701722
`<destination-custom-resource-namespace>` can be omitted if the destination custom resource is created in the same namespace as the application workload.
702723
:::
703724

704-
The code above shows an example how you can then use the `destination` object to perform an OData request against the system.
725+
## Approach 2: Transparent Proxy Loader
726+
727+
The **Transparent Proxy Loader** approach provides centralized proxy configuration where **all destination requests** are automatically routed through a single registered gateway without requiring explicit destination builders.
728+
729+
### When to Use This Approach
730+
731+
- You want all destinations to automatically route through a single [Dynamic Destination Custom Resource](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations)
732+
- You prefer a centralized, "set-it-and-forget-it" configuration approach
733+
- You have many destinations that should all use the same proxy configuration
734+
- You want to minimize code changes when migrating from traditional destination access
735+
736+
### Implementation Examples
737+
738+
**Step 1: Register the Transparent Proxy (typically during application startup):**
739+
740+
```java
741+
// Register with default port 80
742+
TransparentProxy.register("<destination-gateway-host>");
743+
744+
// OR register with custom port
745+
TransparentProxy.register("http://<destination-gateway-host>", 8080);
746+
747+
// OR register with provider tenant ID (default port 80)
748+
TransparentProxy.register("<destination-gateway-host>", "provider-tenant-id");
749+
750+
// OR register with custom port and provider tenant ID
751+
TransparentProxy.register("http://<destination-gateway-host>", 8080, "provider-tenant-id");
752+
```
753+
754+
:::note Provider Tenant ID
755+
The provider tenant ID serves as a fallback when the current tenant cannot be accessed during destination preparation. This is particularly useful in scenarios where tenant information is not readily available, providing a default tenant for authentication and authorization purposes.
756+
757+
The SAP Cloud SDK automatically sets the current tenant ID during requests. The provider tenant ID is only used as a fallback when the current tenant cannot be accessed.
758+
:::
759+
760+
**Step 2: Use destinations normally - they will automatically route through the registered proxy:**
761+
762+
```java
763+
// All subsequent destination requests will be routed through the registered gateway
764+
// No explicit TransparentProxyDestination creation needed
765+
Destination destination = DestinationAccessor.getDestination("my-destination");
766+
767+
List<SalesArea> execute = new DefaultSalesAreaService().getAllSalesArea() // example OData request
768+
.execute(destination);
769+
```
705770

706771
:::tip Connecting to Cloud systems
707-
The above approach is not limited to destinations of proxy type `ON_PREMISE`.
708-
`INTERNET` destinations are equally supported.
772+
Both approaches support destinations of any proxy type including `ON_PREMISE` and `INTERNET` destinations.
709773
:::
710774

711775
### Troubleshooting

0 commit comments

Comments
 (0)