<?xml version="1.0" encoding="UTF-8" ?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.1"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:spring="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
    xmlns:http="http://www.mulesource.org/schema/mule/http/2.1"
    xmlns:axis="http://www.mulesource.org/schema/mule/axis/2.1"	
	xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.1"
       xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.1"	
       xmlns:soap="http://www.mulesource.org/schema/mule/soap/2.1"
	xmlns:ejb="http://www.mulesource.org/schema/mule/ejb/2.0"
	xmlns:jms="http://www.mulesource.org/schema/mule/jms/2.1"
	xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.1"
	xsi:schemaLocation="
                http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
                http://www.mulesource.org/schema/mule/core/2.1                
http://www.mulesource.org/schema/mule/core/2.1/mule.xsd
				http://www.mulesource.org/schema/mule/http/2.1 
http://www.mulesource.org/schema/mule/http/2.1/mule-http.xsd
				http://www.mulesource.org/schema/mule/axis/2.1 
http://www.mulesource.org/schema/mule/axis/2.1/mule-axis.xsd
				http://www.mulesource.org/schema/mule/stdio/2.1
http://www.mulesource.org/schema/mule/stdio/2.1/mule-stdio.xsd
				http://www.mulesource.org/schema/mule/soap/2.1 
http://www.mulesource.org/schema/mule/soap/2.1/mule-soap.xsd
                http://www.mulesource.org/schema/mule/vm/2.1
http://www.mulesource.org/schema/mule/vm/2.1/mule-vm.xsd
                http://www.mulesource.org/schema/mule/ejb/2.0
http://www.mulesource.org/schema/mule/ejb/2.0/mule-ejb.xsd
                http://www.mulesource.org/schema/mule/jms/2.1
http://www.mulesource.org/schema/mule/jms/2.1/mule-jms.xsd
				http://www.mulesource.org/schema/mule/xml/2.1 
http://www.mulesource.org/schema/mule/xml/2.1/mule-xml.xsd">
 
<description>First Prototype of using JMS transport and web services.</description> 

<context:property-placeholder location="proxy.properties"/>  
<http:connector name="HttpConnector"
                proxyHostname="${proxyHostname}"
                proxyPassword="${proxyPassword}"
                proxyPort="${proxyPort}"
                proxyUsername="${proxyUsername}"/>
  



<!--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Connectors with forever retry policy configured
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-->


<spring:bean name="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
	<spring:property name="brokerURL" value="http://localhost:61619" /> 
</spring:bean>

<jms:activemq-connector name="jmsConnector" brokerURL="http://localhost:61619" connectionFactory-ref="jmsConnectionFactory" > 
	<spring:property name="retryPolicyTemplate" > 
		<spring:bean class="org.mule.retry.policies.RetryForeverPolicyTemplate" /> 
	</spring:property>
</jms:activemq-connector>

<!--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Transformers to transform data to respective format
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-->

<jms:object-to-jmsmessage-transformer name="ObjectToJMSMessage" />
<jms:jmsmessage-to-object-transformer name="JMSMessageToObject" />
<xm:xml-to-object-transformer name="XmlToObject"/>
<xml-entity-decoder-transformer name="XmlDecoder"/>

<xm:xslt-transformer name="Xslt3" xsl-file="xsl/MAXIMOTOUA2.xsl"/>

<object-to-string-transformer name="ToString"/>




<message-properties-transformer name="PlainTextResponseTransformer">
<add-message-property key="Content-Type" value="text/plain" /> 
</message-properties-transformer>

<message-properties-transformer name="XmlResponseTransformer">
<add-message-property key="Content-Type" value="text/xml" /> 
</message-properties-transformer>

<message-properties-transformer name="delete-content-type-header">
	<delete-message-property key="Content-type" />
</message-properties-transformer>

<message-properties-transformer name="add-content-type-header">
	<add-message-property key="SOAPAction" value="http://opcfoundation.org/UA/2008/02/Services.wsdl/Write" />
</message-properties-transformer>



<!--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Outbound Endpoints
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-->

<endpoint name="IMAXDispersor" address="http://192.168.3.101:65082/services/DDIFC2DDIFL2EXTSYS" />
<endpoint name="IMAXDispersor1" address="http://192.168.3.103:65082/services/DDIFC2DDIFL2EXTSYS" />



<model name="Router">
<!--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Routers
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-->
	<service name="IMAXRouter">
		<inbound>
			<jms:inbound-endpoint address="jms://EMS.Queue.RunHours" synchronous="false" />
		</inbound>
		<outbound>
			<pass-through-router> 
				<jms:outbound-endpoint address="jms://EMS.Queue.IMAX" /> 
			</pass-through-router> 
		</outbound>

		<default-service-exception-strategy>
			<vm:outbound-endpoint path="systemErrorHandler" /> 
		</default-service-exception-strategy>
	</service>


	<service name="IMAX1Router">
		<inbound>
			<jms:inbound-endpoint address="jms://EMS.Queue.Reply" synchronous="false" />
		</inbound>
		<outbound>
			<pass-through-router> 
				<jms:outbound-endpoint address="jms://EMS.Queue.IMAX1" /> 
			</pass-through-router> 
		</outbound>

		<default-service-exception-strategy>
			<vm:outbound-endpoint path="systemErrorHandler" /> 
		</default-service-exception-strategy>
	</service>



<!--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Dispersor
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-->
	<service name="IMAXDispersorService">
			<inbound>
				<jms:inbound-endpoint address="jms://EMS.Queue.IMAX" synchronous="false" />
			</inbound>
			<outbound>
			<pass-through-router>
					<outbound-endpoint ref="IMAXDispersor" transformer-refs="XmlDecoder delete-content-type-header XmlResponseTransformer" />
			</pass-through-router>
			</outbound>
	</service>


	<service name="IMAX1DispersorService">
			<inbound>
				<jms:inbound-endpoint address="jms://EMS.Queue.IMAX1" synchronous="false" />
			</inbound>
			<outbound>
			<pass-through-router>
					<outbound-endpoint ref="IMAXDispersor1" transformer-refs="XmlDecoder delete-content-type-header XmlResponseTransformer" />
			</pass-through-router>
			</outbound>
	</service>

     


<!--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Common error handler
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

-->
	<service name="SystemErrorHandler">
		<inbound>
			<vm:inbound-endpoint path="systemErrorHandler" synchronous="true" /> 
		</inbound>
		<outbound>
			<pass-through-router>
				<stdio:outbound-endpoint system="ERR" /> 
			</pass-through-router>
		</outbound>
	</service>
  </model>
  
  </mule>

