Basic Usage
This page describes the basics of using iBeans. For information on downloading additional iBeans, see Managing iBeans.
Each iBean is exposed as an annotation (a simple metadata tag you insert in the code) and an API. You can use either annotations or APIs in your Java code depending on personal preference. If you are working with a JSP or other technology that does not support annotations, use the APIs.
For example, to add a send action to a method called hello, you could insert the annotation before the method like this:
@Send(uri = "smtp://ross@password?to=myfriend@mulesource.com") public String hello(String name) { ...
Or you could call the send method from the iBeans context by adding the following line to the end of the method definition:
...
ibeans.send("smtp://ross@password?to=myfriend@mulesource.com")
You can use multiple iBeans annotations on a method. For example, when a method is called, you might want to receive messages from one channel, process the messages, and send the results to another channel:
| Galaxy configuration integration will be implemented in a future release |
@Receive(uri = "vm://test") @Send(config="galaxy:/myApp/myJms") public String processXml(String xml) { //Do something return xml; }
You are now ready to get started using iBeans. The following topics will be especially helpful for getting started:
- Examples - a full set of examples that demonstrate using existing iBeans
- Using the Webapp Archetype and Using the iBean Archetype - quick start for Maven users
- Performing Common Integration Tasks - the basic steps for exchanging data, such as sending and receiving messages
- Using the Annotations - a complete reference to the Mule iBeans annotations you can use in your code
- Write and Test an iBean in 10 Minutes - a quick tutorial for creating your own iBean that connects to an external service like Twitter
Add Comment