My new website on Artificial Intelligence and Machine Learning www.aimlfront.com

Mule basic example with spring and quartz

Mule ESB and the Spring Framework are a powerful combination with a rich history of successful production deployments. Mule and Spring are a natural match - both utilize a streamlined POJO model and XML schema to allow powerful integration solutions to be quickly built around highly specific use cases in a standardized, logical manner.

Spring offers excellent integration between Spring applications, and many organizations have rebuilt their entire infrastructures to take advantage of these features. However, the framework is not designed to handle the complex integration and SOA scenarios in which Mule is known to excel. Using Mule ESB with Spring enables teams to build on Spring's integration capabilities, retaining the value of previous work while implementing additional features such as an extensive library of transports and transformers, powerful routing, orchestration, and governance libraries for the execution of SOA strategies, and massively scalable messaging for mission critical high throughput environments.

<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
	xmlns:quartz="http://www.mulesource.org/schema/mule/quartz/2.2"
	xmlns:spring="http://www.springframework.org/schema/beans"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	http://www.mulesource.org/schema/mule/core/2.2
	http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
	http://www.mulesource.org/schema/mule/stdio/2.2
	http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd 
	http://www.mulesource.org/schema/mule/quartz/2.2
	http://www.mulesource.org/schema/mule/quartz/2.2/mule-quartz.xsd">
	<spring:bean id="welcomeMessage" class="java.lang.String">
		<spring:constructor-arg>
			<spring:value><![CDATA[ 
 _    _      _                            _         ___  ___      _         

| |  | |    | |                          | |        |  \/  |     | |      

| |  | | ___| | ___ ___  _ __ ___   ___  | |_ ___   | .  . |_   _| | ___

| |/\| |/ _ \ |/ __/ _ \| '_ ` _ \ / _ \ | __/ _ \  | |\/| | | | | |/ _ \

\  /\  /  __/ | (_| (_) | | | | | |  __/ | || (_) | | |  | | |_| | |  __/

 \/  \/ \___|_|\___\___/|_| |_| |_|\___|  \__\___/  \_|  |_/\__,_|_|\___

 
___  ___        

|  \/  |       

| .  . |_   _                  ___

| |\/| | | | || '_ ` | '_ `  / _ \

| |  | | |_| || | | || | | || (_) |\

\_|  |_/\__,_||_| |_||_| |_| \___/\_\


		</spring:value>
		</spring:constructor-arg>
	</spring:bean>
	<model name="welcomeModel">
		<service name="welcomeService">
			<inbound>
				<quartz:inbound-endpoint jobName="welcome"
					repeatInterval="0" repeatCount="0">
					<property key="payload" value-ref="welcomeMessage" />
					<quartz:event-generator-job />
				</quartz:inbound-endpoint>
			</inbound>
			<outbound>
				<pass-through-router>
					<stdio:outbound-endpoint system="OUT" />
				</pass-through-router>
			</outbound>
		</service>
	</model>
</mule>

Connector:
STDIO Connector and quartz Connector, Basically quartz connector will work like hitting application automatically with time period and number of times. Here we are not specifying repeatCount with any number so it will work only once.
<quartz:inbound-endpoint jobName="welcome" repeatInterval="0" repeatCount="0">
     <property key="payload" value-ref="welcomeMessage" />
     <quartz:event-generator-job />
 </quartz:inbound-endpoint>

Endpoints:
quartz inbound and STDIO outbound endpoints. Router:
pass-through-router will do whatever input is coming from inbound, it will send as it is to outbound. Output:
" welcomeMessage" is the spring bean injected by the String class. Here it is taking input as this bean and output is generating only once(repeatCount=0) and sending to the STDIO outbound endpoint.
NFO   2012-08-05 20:04:13,279 [connector.stdio.0.dispatcher.11] 
org.mule.transport.stdio.StdioMessageDispatcher:
Connected: endpoint.outbound.stdio://system.out
 _    _      _                            _         ___  ___      _         

| |  | |    | |                          | |        |  \/  |     | |      

| |  | | ___| | ___ ___  _ __ ___   ___  | |_ ___   | .  . |_   _| | ___

| |/\| |/ _ \ |/ __/ _ \| '_ ` _ \ / _ \ | __/ _ \  | |\/| | | | | |/ _ \

\  /\  /  __/ | (_| (_) | | | | | |  __/ | || (_) | | |  | | |_| | |  __/

 \/  \/ \___|_|\___\___/|_| |_| |_|\___|  \__\___/  \_|  |_/\__,_|_|\___

 
___  ___        

|  \/  |       

| .  . |_   _                  ___

| |\/| | | | || '_ ` | '_ `  / _ \

| |  | | |_| || | | || | | || (_) |\

\_|  |_/\__,_||_| |_||_| |_| \___/\_\