java in mule part 2

12
JAVA IN MULE PART - 2 Vasanthii

Upload: vasanthii9

Post on 15-Apr-2017

397 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Java in mule part 2

JAVA IN MULE PART - 2

Vasanthii

Page 2: Java in mule part 2

Java Component with Singleton:The singleton object factory does not create a new instance for each request; instead, the instance is shared. Example:

Drag java component and double click on the java component to bring up properties. Click "+" symbol next to the 'Object' field

Select “core:singleton-object” and click "next".

Page 3: Java in mule part 2

Click on "..." button and select class "com.techm.javacustomcomponents.UsingSingletonObject"

Page 4: Java in mule part 2

Click on "Advanced" tab and create following three properties using "+" as shown below and click on Finish.

• name• dept• location

Same properties with same names need to be created along with setters and getters in "UsingSingletonObject" class. So that, specified properties values in java component are assigned into java class properties. Below is the code to create map object with these three properties.

Page 5: Java in mule part 2
Page 6: Java in mule part 2
Page 7: Java in mule part 2
Page 8: Java in mule part 2

A bean needs to be created in global elements to use Invoke component. Create a bean which refers to a custom made java class in global elements. In "Global Elements" tab click on "Create" button.

Click on "..." symbol next to "Class" field to select a java custom made class. Provide some meaningful names in "ID" and "Name" fields. Click on OK button.

Page 9: Java in mule part 2

Drag a invoke component and double click on the component to bring up the properties. Fill the required fields as shown below.

Page 10: Java in mule part 2
Page 11: Java in mule part 2

Name Any meaningful name Object Ref "ID" value of bean which is created

earlier Method Method name which needs to be invoked Method Arguments Values of method arguments In the same way two more invoke components are

created for two methods (substract and multiply)

Page 12: Java in mule part 2

Thank You All