API-Led Connectivity and Discovery in MuleSoft Runtime Fabric

 API-Let connectivity in MuleSoft Runtime Fabric.

controller

API-Let connectivity is one of the crucial approaches to segregate integrations and processing stages in API based platform.

Points to understand: 

In Runtime Fabric, a DNS record is created for each application deployed in the cluster in the internal "cluster.local" domain.

Example: meetup-xapi-app.e2aaff45-2f2e-4aaa-9332-xxxxxxxxxx.svc.cluster.local"

Where "meetup-xapi-app" is the application name and "e2aaff45-2f2e-4aaa-9332-xxxxxxxxxx" is the namespace name (environment ID).

               Every pod in Runtime Fabric, it looks for domains configured. 

To looks for the DNS query, it searches in each domain until getting a none NXDomain response. Furthermore, to communicate between MuleSoft applications deployed in the same namespace (Under Same Controller instance), an application name can be used to access applications. 

Implementation details as below:

Step 1

API: Experience API (meetup-xapi

API: System API (meetup-sapi)

design center

Step 2: Publish it to Exchange

XExchange

Step 3: Import This Above Apis in-Studio and Enhance Flow So XAPI Can Send Request To SAPI

 XAPI's flow configuration: 

XAPI

 2.  SAPI's flow configuration:         SAPI

 3. Publish to exchange in Anypoint platform using below maven command as below 

XML
 




xxxxxxxxxx
1
39


1
<build>
2
  <plugins>
3
   <plugin>
4
    <groupId>org.apache.maven.plugins</groupId>
5
    <artifactId>maven-clean-plugin</artifactId>
6
    <version>3.0.0</version>
7
   </plugin>
8
   <plugin>
9
    <groupId>org.mule.tools.maven</groupId>
10
    <artifactId>mule-maven-plugin</artifactId>
11
    <version>3.3.5</version>
12
    <extensions>true</extensions>
13
    <configuration>
14
     <runtimeFabricDeployment>
15
      <uri>https://anypoint.mulesoft.com</uri>
16
      <muleVersion>${app.runtime}</muleVersion>
17
      <username>${anypoint.login.id}</username>
18
      <password>${anypoint.login.password}</password>
19
      <applicationName>meetup-sapi-app</applicationName>
20
      <server><sessting.server.id></server>
21
      <target><runtime-fabric-setupname></target>
22
      <environment><associated.environment></environment>
23
      <deploymentTimeout>900000</deploymentTimeout>
24
      <provider>MC</provider>
25
      <properties>
26
       <key>value</key>
27
      </properties>
28
      <deploymentSettings>
29
       <replicationFactor>1</replicationFactor>
30
       <publicUrl>helloworld.kelltontech.com/meetup-sapi-app</publicUrl>
31
       <cpuReserved>500m</cpuReserved>
32
       <memoryReserved>800Mi</memoryReserved>
33
      </deploymentSettings>
34
     </runtimeFabricDeployment>
35
     <classifier>mule-application</classifier>
36
    </configuration>
37
   </plugin>
38
  </plugins>
39
 </build>


   

4: Configure environment variables for applications.

Plain Text
 




xxxxxxxxxx
1


1
./rtfctl apply secure-property --key system.host.ip --value meetup-sapi-app -n e2aaff45-2f2e-4aaa-9332-f7b7e42aa644
2
./rtfctl apply secure-property --key system.host.port --value 8081 -n e2aaff45-2f2e-4aaa-9332-f7b7e42aa644
3
./rtfctl apply secure-property --key system.host.app --value xapi -n e2aaff45-2f2e-4aaa-9332-f7b7e42aa644
4
./rtfctl apply secure-property --key system.host.app --value api/xapi -n e2aaff45-2f2e-4aaa-9332-f7b7e42aa644


 

5: Deploy the application in Runtime Fabric from the exchange:

runtime manager

Now test application to validate request able to reach from XAPI to SAPI.

hello world

How does it communicate?

application POD

[Command: kubectl exec -it meetup-xapi-app-74b84966d6-4dqtxs --namespace=e2aaff45-2f2e-4aaa-9332-f7b7e42aa644 --container=app -- bash] 

send requests

[Command: - curl --location --request GET 'http://meetup-sapi-app:8081/api/xapi' --header 'client_id: 6abd34350a0248a8b9e8d6c566070f06'  --header 'client_secret: 279cB8950f334bAc827C2311009fBB65']

 

 

 

 

Top