Developer Sandbox

Apache Camel is known as the Swiss Army knife of integration. Yet many developers building microservices and delivering platforms that connect apps with backends are still unaware of integration frameworks like Camel, which has been perfected over the years to provide efficient and economical building blocks. Apache Camel excels at simplifying and standardizing your landscape of platform integration services. Camel on Spring Boot is one of the various options for running Apache Camel. Although the latest evolution of Camel offers new runtimes, such as Quarkus or Camel K (also Quarkus-based), Spring Boot is still a popular option for development teams with strong Java know-how.

To learn more about the various Camel runtimes available, read the 3-part series article, Choose the best Camel for your integration ride.

Why you should try Camel in the Developer Sandbox

Experience Camel in the Developer Sandbox for Red Hat OpenShift, a hands-on, free environment. In this developer environment, you can play with Camel Spring Boot and try many other technologies.

You’ll be able to do the following without the hassle of setting up your local environment:

  • Play for free in an OpenShift environment (Developer Sandbox).
  • Use the web-based IDE (Red Hat OpenShift Dev Spaces, formerly Red Hat CodeReady Workspaces) to sample a demo Camel on the Spring Boot project.
  • Run the Camel demo application as if you were developing it in your own IDE.
  • Deploy your Camel application in the Developer Sandbox.

A demonstration of running Camel on Spring Boot

This demo includes an OpenAPI service called simple, and also includes a stub serving XML data to simulate the backend service Camel integrates with. It’s a relatively simple use case but very common in the enterprise. It defines a REST API and hides a legacy service behind the scenes (Figure 1).

Diagram showing the Camel on Spring Boot flow.
Figure 1: The Camel on Spring Boot flow.

 

This example stands out from the data handling point of view, where the JSON input needs to be mapped to the outgoing XML during the request flow and performs the reverse format translation during the response flow, as in Figure 2.

Diagram showing the data format conversion.
Figure 2: JSON / XML data mapping operations.

 

What is unique about Camel running on Spring Boot, but also true for all runtimes, is how little code is required and how elegantly it is laid out. This simplicity guarantees economical, long-term, and sustainable support for your landscape of implemented Camel services.

If you would like to see how all of this is done, jump straight onto the Developer Sandbox to explore the code and execute it. The next section demonstrates how to access the Developer Sandbox. 

How to access the Developer Sandbox

First things first, go to the Developer Sandbox to learn about what you can do. Then follow these steps:

  • Click on the Start your sandbox for free button, as shown in Figure 3.

    Try button to access the developer sandbox
    Figure 3: Access the developer sandbox
  • After that, you will see a login window shown in Figure 4.

    Login window to access the developer sandbox.
    Figure 4. Log in window.
    • If you don’t have a Red Hat account, click on Register for a Red Hat account
    • Enter the details requested and complete the registration process.
    • Once you successfully log in, you will be prompted to start using your sandbox, as shown in Figure 5.

      Ready to start using the developer sandbox.
      Figure 5: Enter the sandbox.
    • Click on the red button Start using your sandbox. This action will take you to the OpenShift Dedicated login page, as shown in Figure 6.

      Confirm the access to the developer sandbox.
      Figure 6: Confirm access to the developer sandbox.
    • Click on DevSandbox.
    • Once you’re in, the environment welcomes you with the message, Welcome to the Developer Perspective!

      Welcome message in the developer sandbox.
      Figure 7: Welcome message in the developer Sandbox.

       

      Feel free to start with a tour that explains the interface features.

    The Developer Sandbox ships with an entire web-based IDE entitled OpenShift Dev Spaces from which you can play with Camel on Spring Boot in a typical developer workflow using a code editor and a terminal. Let us show you how to open it and run the demo.

    How to prepare your dev environment

    To open Dev Spaces: 

    1. Click the applications icon as shown in Figure 8.
    2. Select Red Hat OpenShift Dev Spaces

      Top bar icon to select Red Hat OpenShift Dev Spaces
      Figure 8: How to open OpenShift Dev Spaces.
    3. The action above will open the Create Workspace dashboard in Dev Spaces.
    4. When the Create Workspace dashboard in Dev Spaces opens, copy the snippet below containing the Git repository URL:
      https://github.com/RedHat-Middleware-Workshops/devsandbox-camel.git
    5. And paste the URL in the text box Git Repo URL, highlighted in figure 9:

      Git repository URL configuration
      Figure 9: Git repository URL configuration.

       

    6. Click the Create & Open button.

      While the workspace provisions, you should see a progress log similar to Figure 10.

      Informational window of workspace provisioning.
      Figure 10: Progress log of the workspace provisioning process.

     

    When the IDE shows up, you will open the tutorial that will guide you through the Camel demo project.

    1. Click the deployable Endpoints accordion marked 1 (Figure 11).
    2. Click on the icon (marked 2), which opens the tutorial in a new browser tab.

      Open the tutorial from VSCode user interface
      Figure 11: Open the tutorial from VSCode.
    3. You will be prompted to confirm you want to open an external website, so click Open.
    4. The new browser tab will display the Solution Explorer interface containing tiles for different labs (Figure 12). Select the highlighted tile, Camel Spring Boot - Simple.

      The solution explorer showing the Camel Spring Boot lab.
      Figure 12: The solution explorer interface showing the Camel Spring Boot - Simple lab.

     

    When you click on the tile marked in red, the Solution Explorer will initiate the lab showing its introduction and exercise chapters, which you can complete in around 15 minutes. The exercises involve easy copy/paste actions to provide a smooth experience, demonstrating the highlights of Camel Spring Boot.

    Enjoy the Camel ride!

    This is only the start

    This article ends here, but this should only be the start of your journey with Apache Camel. The Developer Sandbox gives you the opportunity to play on a Kubernetes-based application platform with an integrated developer IDE (OpenShift Dev Spaces). Even for those unfamiliar with Kubernetes environments, this demo lab is great for sampling what it’s like to build applications with Camel.

    With just your browser, you can quickly complete the Camel Spring Boot lab and see for yourself how simply Camel resolves a typical use case and how easy it is to test, containerize, and run in OpenShift. Camel on Spring Boot keeps the key benefits Spring Boot lovers seek with easier development, auto-configuration, straightforward setup, and management.

    Camel has also evolved to run in container-tailored runtimes specifically designed to minimize memory footprint and maximize performance. If you want to learn more, check out these resources:

    Last updated: October 6, 2023