Apigee : Deploy proxy with Maven

Hello All,
As you all know, there are are so many ways to construct a structure for modular project in Information Technology. We can create our application in any of the following ways,

  • Monolithic Architecture,
  • Microservice Based Architecture

When the architecture is microservice based, some API platform has to be used to maintain the performance measurements of the microservices. With the API platform software, we can track the request as well as the responses coming to a microservice route URL and how many calls are made to this at a given period of time.

In this blog, we are going to use Apigee as the API platform. Apigee follows a proxy based architecture and deployment of the Proxy can be made via various ways.

What is Apigee Maven plugin ?

Apigee maven plugin maven bundle is a plugin provided by Apigee which is used to create aproxy as same as created on Apigee. The proxy bundle is a collection of the following contents,

  • Proxies,
  • Policies,
  • Resources

In the proxy bundle project, we are going to show a hello message to the user. And every time the proxy is deployed, it will have a new revision.

Creating a Proxy Bundle

Create a maven project containing an Apigee module as below,

z

In the above project structure,

  • apigee module defines the proxies we are a user wish to deploy on Apigee,
  • HelloWorld is the proxy bundle which contains all the required policies and resources for proxy creation,
  • shared-pom file is an xml file which defines the plugins for Apigee and the deployment environment information.

First we include the shared-pom file in the parent pom of the project, as a relative path as below,

Now we provide the plugins provided by Apigee in the shared-pom.xml and include a profile. A profile contains the following information,

  • Environment name – It is test in our project. It can be anything prod, test or any custome generated by a paid account on Apigee,
  • Organization name – It is the name of the organization on which the proxy bundle has to be deployed,
  • Host URL – It is the host URL of the apigee account,
  • Api version – It is the name of the version a user need to put for the bundle,
  • Credentials – It defines the username and password of the user account if it required by the Apigee.

According to above information, Profile is defined in our project as below,

Now to include Apigee plugin we need to define the plugins as below,

Deployment to Apigee Environment

Open the terminal and go to directory ..ApigeeMavenDemo/apigee/HelloWorld$ and use the following command,

Above command defines the following properties,

  • Environment Name on which the proxy has to be deployed,
  • Username of the user’s account on Apigee,
  • Password of the user’s account on Apigee,
  • Organization Name of the user’s account on Apigee

Note : We need to use the following command in case a paid account has been created and an official environment has been setup for deployment,

After we execute this command successfully, following output will be shown in the terminal,

y

In the final output it shows the Build Success along with the Deployed Revision number as 5 in our deployment. In the project we have created, we set up environment to create a new Revision every time the deployment is done.

As we notice, following tag,

 defines the behavior of the deployment Revision. If it is set to true, then new revision will be created, otherwise revision will not be created and we need to update the existing revision.

Proxy Execution

In our proxy, we are showing the hello message to the user and then stores the message into Cache of the Apigee 60 seconds.

Following is the way we are executing the proxy endpoint on Apigee Environment,

a

Following is the output after we execute it thorough the Apigee Environment,

s

 

 

 

 

 

 

 

 

Now as we can see first request executed with in 362 milliseconds because it generated a response and inserted the response into Cache for 60 seconds. After that all the request except the request number 8, took the minimum time for their execution, as they are reading the response from the Cache.

That’s how you deploy the Apigee Proxy with maven on Apigee.

You can find the complete project here.

Keep learning,

Thank You !!

1 thought on “Apigee : Deploy proxy with Maven

  1. Thats a clear explanation but What i dont understand is how does maven which is third party tool could deploy by connecting to APIGEE ??

Leave a Reply

%d bloggers like this: