In this article we will look into custom component creation using Mule Studio
Introduction
Though Mule Studio has a lot of built in componets , however, it does provides opportunities to create our own. This article will talk about that.
What we need to have for doing the experiment?
We need
- Download Mule ESB
- Everything should be up and running properly
Let us start the experiment
First create a Mule Project.Then create a "Project" from the "src/main/java"

From the "New Java Package" window that appears, enter "org.mule.customcomponentexamples" in the Name field.Click "Finish" button

Now, from the package created, right click on that to create a "Class"

Once the "New Java Class" window opens, enter "MyClass" in the "Name" field and click on "Finish" button.

Write the below code in "MyClass.Java"
package org.mule.customcomponentexamples;
import java.util.*;
import java.text.*;
public class MyClass
{
public String SayHello(String strName)
{
Date presentDate = new Date();
SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
String currentDateTime = ft.format(presentDate);
return "Welcome " + strName + " .It is: " + currentDateTime;
}
}
Now from the EndPoints pallete, choose Http Endpoint and change it's Port to 8082.Next from the Components pallete, choose "Java" component

Drag and drop it on the "Message Flow" container.

Double click on the "Java Component" and from the properties window that appears, enter "org.mule.customcomponentexamples.MyClass" in the "Class Name".Click "OK" once done.

Run the application
We are now almost done.Next we need to run the application.Right click on "CustomComponentExperiment.mflow" and from the context menu, choose Run As->Mule Application.
We will encounter the below screen at some point of time

Because it is looking for the input data.So open up the browser, and type "http://localhost:8082/Niladri".Press Enter.
The output in the browser is as under

References
Working with Components
Conclusion
Hope you have enjoyed the tutorial.More to come soon.