Created
May 20, 2020 12:22
-
-
Save jeffreycassar/d83f39d2c32a05333ecad011119be5b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" | |
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:context="http://www.springframework.org/schema/context" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" | |
xmlns:spring="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd | |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd | |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd | |
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd | |
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd | |
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd | |
http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd | |
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd | |
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd | |
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd | |
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd"> | |
<context:property-placeholder location="sample-app.properties" /> | |
<spring:beans> | |
<spring:bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"> | |
<spring:property name="driverClassName" value="org.h2.Driver" /> | |
<spring:property name="jdbcUrl" value="${db.jdbcUrl}" /> | |
<spring:property name="username" value="${db.user}" /> | |
<spring:property name="password" value="${db.password}" /> | |
<spring:property name="maximumPoolSize" value="${db.maxPoolSize:32}" /> | |
<spring:property name="minimumIdle" value="${db.minIdleConnections:4}" /> | |
<spring:property name="poolName" value="dbConnectionPool" /> | |
</spring:bean> | |
<spring:bean id="WMQ_ConnectorFactory" name="WMQ_ConnectorFactory" class="com.ibm.mq.jms.MQConnectionFactory"> | |
<spring:property name="connectionNameList" value="${wmq.connectionString}" /> | |
<spring:property name="queueManager" value="${wmq.queueManager}" /> | |
<spring:property name="channel" value="${wmq.channel}" /> | |
<spring:property name="clientReconnectTimeout" value="${wmq.reconnect.timeout:30}" /> | |
<spring:property name="transportType" value="#{T(com.ibm.msg.client.wmq.common.CommonConstants).WMQ_CM_CLIENT}" /> | |
<spring:property name="clientReconnectOptions" value="#{T(com.ibm.msg.client.wmq.common.CommonConstants).WMQ_CLIENT_RECONNECT}" /> | |
</spring:bean> | |
<spring:bean id="txAwareDSConnProvider" class="com.ricston.sample.TxAwareDataSourceConnectionProvider" /> | |
</spring:beans> | |
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> | |
<db:generic-config name="Generic_Database_Configuration" dataSource-ref="dataSource" doc:name="Generic Database Configuration"/> | |
<wmq:connector name="WMQConnector" username="${wmq.user}" password="${wmq.password}" maxRedelivery="${wmq.maxRedelivery:-1}" | |
numberOfConcurrentTransactedReceivers="${wmq.receivers:4}" connectionFactory-ref="WMQ_ConnectorFactory" validateConnections="true" doc:name="WMQ" transportType="CLIENT_MQ_TCPIP"> | |
<reconnect blocking="false" frequency="${wmq.reconnect.frequency:2000}" count="${wmq.reconnect.count:2}" /> | |
</wmq:connector> | |
<flow name="test-flow"> | |
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> | |
<dw:transform-message doc:name="Store person info in flowVar"> | |
<dw:set-variable variableName="personInfo"><![CDATA[%dw 1.0 | |
%output application/java | |
--- | |
payload]]></dw:set-variable> | |
</dw:transform-message> | |
<ee:multi-transactional action="ALWAYS_BEGIN" doc:name="Transactional"> | |
<!-- <db:insert config-ref="Generic_Database_Configuration" doc:name="Insert Person into DB"> --> | |
<!-- <db:parameterized-query><![CDATA[INSERT INTO PEOPLE VALUES(:firstname,:lastname,:age)]]></db:parameterized-query> --> | |
<!-- <db:in-param name="firstname" value="#[flowVars.personInfo.firstname]"/> --> | |
<!-- <db:in-param name="lastname" value="#[flowVars.personInfo.lastname]"/> --> | |
<!-- <db:in-param name="age" value="#[flowVars.personInfo.age]"/> --> | |
<!-- </db:insert> --> | |
<custom-processor class="com.ricston.sample.processors.InsertPersonMessageProcessor" doc:name="Insert Person into DB"></custom-processor> | |
<wmq:outbound-endpoint queue="${wmq.queue}" doc:name="Put person info onto queue" connector-ref="WMQConnector"> | |
<ee:multi-transaction action="ALWAYS_JOIN"/> | |
</wmq:outbound-endpoint> | |
<!-- <scripting:component doc:name="Script"> --> | |
<!-- <scripting:script engine="Groovy"><![CDATA[throw new java.lang.Exception('Error!');]]></scripting:script> --> | |
<!-- </scripting:component> --> | |
<logger level="INFO" doc:name="Logger"/> | |
<rollback-exception-strategy doc:name="Rollback Exception Strategy"> | |
<logger level="INFO" doc:name="Rolled back as something went wrong" message="Rollback"/> | |
</rollback-exception-strategy> | |
</ee:multi-transactional> | |
<dw:transform-message doc:name="OK message"> | |
<dw:set-payload><![CDATA[%dw 1.0 | |
%output application/json | |
--- | |
{ | |
message: "OK" | |
}]]></dw:set-payload> | |
</dw:transform-message> | |
</flow> | |
</mule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment