01 Lab Primer Mule 3 Configuration (MS)

12
Module 01- Fundamental Mule 3 Module 1 Lab Primer - Mule 3 Configuration

Transcript of 01 Lab Primer Mule 3 Configuration (MS)

Page 1: 01 Lab Primer Mule 3 Configuration (MS)

Module 01-Fundamental Mule 3

Module 1 Lab Primer - Mule 3 Configuration

Page 2: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Use Case Overview

Page 3: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Minor Simplification

Page 4: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Final Result (Client perspective)

Page 5: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Final Result (Developer Perspective)

Page 6: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

First Task

Page 7: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Hello World Equivalent

SFO 500

Page 8: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Simplest Ticket Component

public class SimpleTicketPriceComponent {public String priceRequest(String airportCode) throws Exception{

if(airportCode.equals("SFO")){

return "300";}else if (airportCode.equals("MLT")){

return "1300";}else if(airportCode.equals("HEL")){

return "300";}else{

return "Unknown code "+airportCode;

}}

}

What about using a Map instead of static values?

What about making the component configurable through Spring?

Page 9: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

STDIO Connector Primer

<stdio:connector name="stdioConnector"

promptMessage="Enter Airport Code:"messageDelayTime="500"

outputMessage="Price:"/>

Page 10: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Other Snippets

<stdio:inbound-endpoint system="IN"/><stdio:outbound-endpoint system="OUT"/>

<component class="…"/><component>

<spring-object bean="BeanId"/></component>

<spring:bean id="BeanId"><spring:property name="priceMap">

<spring:map><spring:entry key="SFO">

<spring:value>500</spring:value></spring:entry>

Page 11: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Practical Lab

Take input from console in the form of airport code:– MLT, SFO, HEL

Display the price of the ticket to screen:– 300,400

Must create POJO and use it as a component in the configuration

Optional:– Make POJO configurable through configuration

– Configure STDIO connector to have a more

user friendly application

Page 12: 01 Lab Primer Mule 3 Configuration (MS)

All contents Copyright 2011, MuleSoft Inc.

Downloads

Getting Started with the IDE

Download Eclipse

Mule IDE

Java SDK

Mule Enterprise Trial