Skip to Content
Technical Articles
Author's profile photo Mayura Belur Mohana

Connecting to MongoDB server from SAP Cloud Platform Integration using Camel MongoDB component

This blog is a continuation series of the our earlier blog ,  which talks about usage of Apache Camel Components as SAP Cloud Platform integration ADK compliant integration adapters in the integration flow.

In this series let us understand how to use the Apache camel MongoDB component as the SAP cloud platform integration adapter.

You can find the adapter artifacts in the SAP GitHub apibusinesshub-integration-recipes, whose link is provided below

In the Apache Camel MongoDB component, it looks for a bean to resolve the MongoDB server details, here in the code that bean lookup is bypassed with the manual server configuration, which you have to provide in the project source.

Please import the project source in to Eclipse IDE using Maven project import wizard and edit the class ,CreateEndpoint method and provide the mongoDB server configuration as shown below:

after doing the changes, build the project using “maven clean install” and generate the adapter ESA file. which you have to deploy in to the CPI integration runtime

Deploy the Integration adapter ESA file on to the SAP cloud platform integration runtime

After successful deployment you can see the adapter under the deployed artifacts

As a next step You can import the integration flow, which is provided as a part of artifacts, which demonstrate the usage of the Apache Camel MongoDB component.

After importing the MongoDB integration flow, you can provide MongoDB server configuration

you can see an example configuration shown in the adapter property sheet

After providing all the configuration, save/deploy the integration flow and check that the integration flow message processing successfully completed in the CPI monitoring.

Input provided in the Integration Flow for storing the message payload into the MongoDB database

You can connect to MongoDB database server from any of standard Clients and check the message persisted from SAP Cloud Platform Integration flow message processing

You can also use the Apache Camel MongoDB component project source provided as a part of artifact samples, modify it as per your requirements by importing the project in to Eclipse IDE using Maven project import wizard.

Do your changes as required, build the final project using Maven build, which will generate the ESA file, which is the Cloud integration ADK compliant adapter.

Also going forward, we continue to provide more samples of Apache Camel components (  ) as Cloud integration ADK Compliant adapters. Here all the components we provide based on Apache Camel version 2.17.4.

Disclaimer: This adapter is shipped as “community contribution” under Apache 2.0 license; support for this adapter should be requested by raising an issue in the GitHub repo and not standard SAP channels.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Leonardo Valderrama
      Leonardo Valderrama

      Hello Mayur!

      Great article, so by default natively CPI can be integrated with mongoDB? or the only way is to use the apache camel connectors?

      Author's profile photo David BIZIEN
      David BIZIEN


      First question :
      That mean that the connection to the Mongodb database is hard coded in the adapter ?
      So, if I have 3 databases dev, test Prod, I need 3 adapters.

      Second question :
      My database need a user and password.
      So I have to to use something like that : mongodb://username:password@localhost/mydb
      Is it correct ? that mean that my user/password are also hard coded. Is there a security risk there ?

      Third question :
      My database is on premise. So, I guess I need to use the cloud connector. how do it interface with the adapter ?

      David Bizien