Create Custom Component Using Mule Studio

Posted by in Mule category on for Beginner level | Points: 250 | Views : 12527 red flag

In this article we will look into custom component creation using Mule Studio


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

  1. Download Mule ESB
  2. 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


Working with Components


Hope you have enjoyed the tutorial.More to come soon.

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Niladri Biswas
Member Level: Platinum
Member Status: Member
Member Since: 10/25/2010 11:04:24 AM
Country: India
Best Regards, Niladri Biswas
Technical Lead at HCL Technologies

Login to vote for this post.

Comments or Responses

Posted by: Vedantydv123 on: 2/13/2019 | Points: 25
Thank you so much for this site and Its so good for the create our own knowledge about the system and now its available for the user here we can work hard for the system.

Login to post response

Comment using Facebook(Author doesn't get notification)