Skip to main content

Creating Jetlets

Introduction#

The user should’ve created their APIs in the last lesson. In this lesson, we will continue by creating another resource, a Jetlet. A Jetlet is a component that you can create yourself to successfully accomplish your use case. Jetic offers several components (over 300) out of the box. As your requirements change you may find yourself wanting to create your own components and that is where Jetlets come in. We will. show you an example here you can get started with.

VisionsCorp’s request#

VisionsCorp (VC) needs to migrate its Database operations to Jetic. They are using an MySQL database and they have a need for you to create a Jetlet to continue with this integration (started in the previous lesson).

  • SQL (created in the last lesson)
  • Marshal
  • Log

Step 1: Create a new Jetlet#

Docusaurus

  • In the Management console, click on Jetlets in the side bar
  • Click on ‘Add Jetlet’
  • Name the Jetlet ‘JsonSQL’
  • Drag a SQL component into the swing-lane
  • In the Query tab add {{query}}
  • In the data source bean add the name of the previously sourced Bean, in this case we named our bean #logistics
  • Add a Log component under the SQL component
  • For the log message, we will put ‘Converting result to JSON’.
  • Add a toJson component under the log (you may also choose a Marshal component and choose to use the Jackson library. With Jetic, you may choose to go a different way and accomplish the same tasks depending on your preference)
  • Click on the Apply ▶️

Step 2: Create another Jetlet#

Docusaurus

  • In the Management console, click on Jetlets in the side bar
  • Click on ‘Add Jetlet’
  • Name the Jetlet ‘ReadJson’
  • Drag a Log component into the swing-lane
  • In the Message **tab add something like ‘Reading from Json’.**
  • Add a YAML Processor component under the Log component
  • For the YAML body, we will put - unmarshal: json: {}
  • Click on the Apply ▶️

🎉 Congratulations you have successfully created your first Jetlets. With Jetlets you can choose to create your very own components and even successfully compartmentalize certain functions for clean routes. 🎉