-
Notifications
You must be signed in to change notification settings - Fork 0
getting started flows
-
Open Mule Studio and select your project workspace: File->New->Mule->Mule Project
-
Name your project sample-project. "New Mule Flow" dialog pops up, click "Finish" at the bottom.
-
sample-project is now displayed and open. This tree will contain all resources, source files, project configs in the center window displays the essential core of mule the flow -
- an empty flow in mule studio displays the message
- to begin, drop an endpoint or a composite source here from the palette... the right pane is the tool palette."
- in the text entry box labeled Filter type: "http"
- under endpoints, click and drag HTTP to the flow. You made a webserver that does nothing.
- again, in the filter text box type:"javascript"
- under Transformers drag Javascript right up next to the blue HTTP icon.
- note:You'll notice the icon changes to a little plus sign when you've dragged it close enough to the http icon to let go.````
- double click on the green javascript icon. In the Script Text: textarea type "result = 'hello world';"
- click "ok"
-
Double click the blue HTTP icon. Feel free to change the display name or the port or the host if you know the ip address you want this http endpoint to bind to.
-
If you want to change the 'path' of the http endpoint, only thing you should note is that a path must NOT start with /
-
Finally save the flow +s or File->save
-
Right click on sample-project.mflow (in the left pane in your project under the flows folder. select "Run As"->"Mule Application"
- The console pops up (about 5-10 seconds)
-
Go to browser: http://localhost:8081/
- hello world
-
If you want to access query string parameters in your script transformer
var map = message.getInboundProperty( 'http.query.params' ); var qParam = map.get("q"); result = 'hello world ' + qParam;
-
Go to browser: http://localhost:8081/?q=wooooo
- hello world woooo
- git clone existingproject.git
- Open MuleStudio
- Import --> General --> Existing Projects into Workspace
- Point to where you cloned project in step 1