You can view the endpoints of a message flow that is deployed in the IBM® App Connect Enterprise
Toolkitby using the IBM Integration API.
Before you begin
- Create and start an Integration Server and set the value of the administration port to 7600 as
described in Creating, starting, and stopping a local, independent integration server by using the Toolkit.
- You need to deploy an application that uses HTTP or SOAP transport. For example, you can import
and run the Using an HTTP input to drive a message flow tutorial by
completing the following steps:
- In the IBM App Connect
Enterprise Toolkit, open the Tutorials Gallery, search for HTTP,
and select Using an HTTP input to drive a message flow.
- Import and run the tutorial by completing the tutorial instructions.
For more information, see Tutorials for IBM App Connect Enterprise.
.
- Confirm that the
HTTPInputApplication
is running on your Integration Server by
viewing the contents of your Integration Server in the Integration Explorer view of the IBM App Connect
Enterprise Toolkit, or by using the IBM App Connect Enterprise web
user interface as described in Accessing the web user interface.
About this task
You must install IBM App Connect Enterprise 12.0.8.0 or later to use this
feature.
Procedure
- Create a Java™ project by following the steps that are
described in Configuring the Eclipse environment to run custom integration applications.
- Add the following code to a class called RetrieveEndpointsExample in your Java project:
package com.ibm.integration.admin;
import java.io.IOException;
import com.ibm.integration.admin.http.HttpClient;
import com.ibm.integration.admin.http.HttpResponse;
import com.ibm.integration.admin.model.MessageFlowModel;
import com.ibm.integration.admin.model.flow.MessageFlowActive;
import com.ibm.integration.admin.model.rm.EndpointResourceManager;
import com.ibm.integration.admin.model.rm.EndpointResourceManagerActive;
import com.ibm.integration.admin.model.rm.EndpointResourceManagerEndpoint;
import com.ibm.integration.admin.proxy.ApplicationProxy;
import com.ibm.integration.admin.proxy.IntegrationAdminException;
import com.ibm.integration.admin.proxy.IntegrationServerProxy;
import com.ibm.integration.admin.proxy.MessageFlowProxy;
public class RetrieveEndpointsExample {
public static void main(String[] args) {
try {
IntegrationServerProxy myServer = new IntegrationServerProxy("localHost",7600,"","",false);
String myAppName = "HTTPInputApplication";
ApplicationProxy myApp = myServer.getApplicationByName(myAppName, true);
if (myApp != null)
{
String messageFlowName = "HTTPInputMessageFlow";
MessageFlowProxy myFlow = myApp.getMessageFlowByName(messageFlowName, null, true);
MessageFlowModel flowModel = myFlow.getMessageFlowModel(true);
MessageFlowActive messageFlowActive = flowModel.getActive();
String endpointsUri = messageFlowActive.getEndpointsUri();
try
{
HttpClient httpClient = new HttpClient("localHost",7600, null, null, false);
HttpResponse httpResponse = httpClient.getMethod(endpointsUri, false);
EndpointResourceManager endpointResourceManager = httpResponse.parseResponseBody(EndpointResourceManager.class);
EndpointResourceManagerActive endpointResourceManagerActive = endpointResourceManager.getActive();
EndpointResourceManagerEndpoint[] endpoints = endpointResourceManagerActive.getEndpoints();
for (int i = 0; i < endpoints.length; i++)
{
String[] sourceURIs = endpoints[i].getSourceURIs();
for (int uriIndex = 0; uriIndex < sourceURIs.length; uriIndex++)
{
System.out.println("Endpoint Location = " + endpoints[i].getEndpointLocation());
System.out.println("Endpoint Transport = " + endpoints[i].getTransport());
System.out.println("Endpoint Direction = " + endpoints[i].getDirection());
System.out.println("Source URI = " + sourceURIs[uriIndex]);
}
}
}
catch (IOException | InterruptedException e)
{
e.printStackTrace();
}
}
} catch (IntegrationAdminException e) {
e.printStackTrace();
}
}
}
- Run the class by right-clicking it and selecting Run As → Java Application.
The following output is displayed in the Eclipse Console window:
Endpoint Location = http://hostname:7800/HTTPInputMessageFlow
Endpoint Transport = HTTP
Endpoint Direction = Input
Source URI = /apiv2/applications/HTTPInputApplication/messageflows/HTTPInputMessageFlow/nodes/HTTP%20Input