concept component in category mule

This is an excerpt from Manning's book Mule in Action, Second Edition.
As components (discussed in chapter 6), they perform business operations on the messages. Most of the time, you’ll be configuring message processors without knowing it; all you’ll see in your configuration files will be transformers, components, or endpoints. The fact that all these diverse entities are message processors is the key to Mule’s versatility; it allows you to freely tie them together in flows, since behind the scene they’re all of the same nature and thus interchangeable.
The component is expensive to create— It’s important that the total number of component object instances remains under control. The component is thread-unsafe— It’s essential to ensure that only one thread at a time will ever enter a particular instance of the component.
This configuration pattern uses the word simple in its name, and that’s risky (even if it’s related not to the pattern but to the service). Let’s check how appropriate the use of that word is in the next listing by exposing in an endpoint one of the components used in the previous section.
Listing 6.10. Simple service
<pattern:simple-service name="recicling-service" address="vm://recicledCount.in" component-class= "com.prancingdonkey.reciclingplant.RecicledCountComponent"/>That was simple! You set the name for the service, a request-response address, and the component class that will handle the request, et voilà! A component is facing the world. But you passed a component class and an address instead of a reference to an endpoint or the component.
You use the message variable
to set the PRIORITY message property (header) to HIGH. The component then exists, and the modified message is sent out through the outbound endpoint.
Embedding a script in your Mule configuration can be convenient when the script is small enough, but managing larger scripts in the context of a Mule XML configuration can quickly become unwieldy. As such, it’s possible to reference a script stored in an external file. In listing 6.5, you implemented a component that took the MD5 hash of a specified file. Let’s take a variation of this functionality and see how it can be implemented using an external script. You’ll implement a Rhino script that will take the MD5 hash of the payload of a message and attach it as a property of that message. This property can then be used to ensure the payload of a message hasn’t changed when processed by future services. The following listing illustrates a Rhino script external to the Mule configuration to accomplish this.
to set the PRIORITY message property (header) to HIGH. The component then exists, and the modified message is sent out through the outbound endpoint.