Mule Magento Cloud Connector 2.0, Missing transformer? - magento-1.7

EDIT: Solved. At the time of asking this question, the Magento Cloud Connector is/was too old to work with Magento 1.7.
I'm trying to do a product update using the magento cloud connector. My xml looks as follows:
<magento:update-product config-ref="testConfig" doc:name="Update Product" productSku="#[header:OUTBOUND:ProductId]">
<magento:catalog-product-entity name="#[header:outbound:Name]">
</magento:catalog-product-entity>
<magento:additional-attributes>
<magento:additional-attribute key="isbn" value-ref="#[header:OUTBOUND:ISBN]" />
<magento:additional-attribute key="subject" value-ref="#[header:OUTBOUND:Subject]" />
</magento:additional-attributes>
</magento:update-product>
Trying to do the update always results in the following exception:
Root Exception stack trace:
org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}".
Full stacktrace:
ERROR 2013-05-02 09:28:37,056 [[asdasd].httpConnector.receiver.05] org.mule.exception.CatchMessagingExceptionStrategy:
********************************************************************************
Message : Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}".
Type : org.mule.api.transformer.TransformerException
Code : MULE_ERROR-236
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html
********************************************************************************
Exception stack is:
1. Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}". (org.mule.api.transformer.TransformerException)
org.mule.registry.MuleRegistryHelper:252 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
********************************************************************************
Root Exception stack trace:
org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}".
at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
at org.mule.module.magento.processors.AbstractExpressionEvaluator.transform(AbstractExpressionEvaluator.java:329)
at org.mule.module.magento.processors.AbstractExpressionEvaluator.evaluateAndTransform(AbstractExpressionEvaluator.java:202)
at org.mule.module.magento.processors.AbstractExpressionEvaluator.evaluateAndTransform(AbstractExpressionEvaluator.java:169)
at org.mule.module.magento.processors.UpdateProductMessageProcessor.process(UpdateProductMessageProcessor.java:171)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:101)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:112)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.construct.Flow$1.process(Flow.java:74)
at org.mule.construct.Flow$1.process(Flow.java:69)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:63)
at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:3...
********************************************************************************
And the xml:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:magento="http://www.mulesoft.org/schema/mule/magento" 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" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/magento http://www.mulesoft.org/schema/mule/magento/1.1/mule-magento.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/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<magento:config name="testConfig" username="username" password="password" address="wsdllocation" doc:name="Magento"/>
<flow name="push-products-to-magentoFlow1" doc:name="push-products-to-magentoFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="20008" doc:name="HTTP" path="productsToMagento"/>
<logger level="INFO" message="'#[header:OUTBOUND:ProductId]'" doc:name="Logger"/>
<logger level="INFO" message="'#[header:OUTBOUND:Name]'" doc:name="Logger"/>
<magento:get-product config-ref="testConfig" doc:name="Get Product" productSku="#[header:OUTBOUND:ProductId]">
<magento:attributes-names>
<magento:attributes-name>sku</magento:attributes-name>
</magento:attributes-names>
</magento:get-product>
<logger message="******************* AFTER GET PRODUCT *********************" level="INFO" doc:name="Logger"/>
<magento:update-product config-ref="testConfig" doc:name="Update Product" productSku="#[header:OUTBOUND:ProductId]">
<magento:catalog-product-entity name="#[header:outbound:Name]" price="#[header:OUTBOUND:Price]">
</magento:catalog-product-entity>
<magento:additional-attributes><!-- value-ref causes transformer exception? -->
<magento:additional-attribute key="isbn" value-ref="#[header:OUTBOUND:ISBN]" />
<magento:additional-attribute key="subject" value-ref="#[header:OUTBOUND:Subject]" />
</magento:additional-attributes>
</magento:update-product>
<logger message="************** PRODUCT UPDATE SUCCESFULL ************" level="INFO" doc:name="Logger"/>
<object-to-string-transformer doc:name="Object to String"/>
<echo-component doc:name="Echo"/>
</flow>
</mule>
As noted in the comments, I think the problem is around the additional attributes block where it tries to convert a value from string to AssociativeEntity, but fails. I am not quite sure about what the correct syntax for defining additional attributes is, as the api sample does not have additional attributes defined.
edit:
Changing from value-ref to value solved the transformer problem, but not the underlying problem I had. The connector uses too old wsdl as Masse pointed out below.

It seems as if in this situation value-ref isn't the correct attribute to use, instead value is ok. This doesn't however solve the situation as the wsdl used in magento-connector is outdated.
The current magento-connector wsdl is magento 1.5 compliant. The wsdl was generated in May 2011, whereas magento modified their wsdl October 2011 by adding single_data field.
So the answer to the real question behind this is that as it is, it can't be done. The magento-connector plugin needs to be updated, magento downgraded or WS-I compliance mode enabled, which has its own drawbacks

Related

Mule SFTP Component component

I am developing mule flow wherein mule process has to upload file/files (from source directory) to SFTP server.
IN Folder (This folder holds file to transfer to SFTP)
I have below mule flow
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:sftp="http://www.mulesoft.org/schema/mule/sftp" 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.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/sftp http://www.mulesoft.org/schema/mule/sftp/current/mule-sftp.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<flow name="sftpFlow1">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="30" startDelay="10" timeUnit="SECONDS"/>
<logger message="Hi" level="INFO" doc:name="Logger"/>
</poll>
<flow-ref name="sftpSub_Flow" doc:name="Flow Reference"/>
</flow>
<sub-flow name="sftpSub_Flow">
<file:outbound-endpoint path="D:\IN" responseTimeout="10000" doc:name="File"/>
<sftp:outbound-endpoint exchange-pattern="one-way" host="host" port="port" path="sftppath" user="user" password="password" responseTimeout="10000" doc:name="SFTP"/>
</sub-flow>
</mule>
Issues:
I don't see any error or exceptions but expected files from IN folder are not getting transfer SFTP server. I see ****.dat file every time sub-flow executes.
Any suggestion?
Here you have used both outbound end points. You need file inbound end point component to pick the file from source location.
refer below sample for further
https://dzone.com/articles/anypoint-file-connector-with-mulesoft
you can use the outputPattern property in sftpoutbound endpoint to change the file name with any extension
Because the application doesn't actually show any input, I'll assume that the sample is flawed but the real application has some inbound endpoint (for example a file inbound endpoing) that is reading in streaming mode. The subflow is trying to consume two time the input stream to output to the two outbound endpoints. Because the first one consumes the stream the second one, the SFTP, gets a consumed empty stream as input so it doesn't output anything. A solution is to convert the input to something in memory, like using the object to byte array transformer in the middle. Be warned that for large files you might run out of memory doing this.

AMQPConnector on Mule - SocketException: Too many open files

I'm working a long time with Mule application and AMQPConnector.
Before some days I saw an ERROR: Too many open files, crash, and can't send request till I'm restarted the Mule application.
Mule code is something like this: (critical parts)
<amqp:connector name="AMQPConnector" validateConnections="true"
doc:name="AMQPConnector" host="x.x.x.x" port="5672"
password="xxxxx" username="xxx">
<reconnect-forever frequency="1000" blocking="false" />
From flows:
<flow name="first">
<http:listener config-ref="HTTP_Listener_Configuration" path="order/submit" doc:name="HTTP"/>
<byte-array-to-object-transformer doc:name="Byte Array to Object"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<json:json-to-object-transformer returnClass="java.lang.Object" doc:name="JSON to Object"/>
<set-session-variable value="#[payload]" variableName="order" doc:name="Session Variable" />
<set-payload doc:name="order" value="#[payload.info]" />
<amqp:outbound-endpoint queueName="xxxx"
responseTimeout="100000" exchange-pattern="request-response"
connector-ref="AMQPConnector" doc:name="XXXX" />
<object-to-string-transformer doc:name="Object to String"/>
<logger message="response from queue #[payload]"
level="INFO" doc:name="Logger" />
</flow>
<flow name="second">
<amqp:inbound-endpoint queueName="xxxx"
responseTimeout="10000" exchange-pattern="request-response"
connector-ref="AMQPConnector" doc:name="AMQP-0-9" />
<byte-array-to-object-transformer doc:name="Byte Array to Object" />
<json:object-to-json-transformer doc:name="Object to JSON" />
<http:request config-ref="HTTP_Request_XXXX" host="#[sessionVars['partUrl']]" path="#[sessionVars['path']]" method="#[sessionVars['method']]" doc:name="HTTP">
<http:request-builder>
<http:header headerName="#[sessionVars['key']]" value="#[sessionVars['value']]"/>
</http:request-builder>
</http:request>
</flow>
The error exception log is:
2016-11-27 04:30:12,272 [amqpReceiver.1018] ERROR org.mule.exception.CatchMessagingExceptionStrategy -
Message : Error sending HTTP request. Message payload is of type: String
Code : MULE_ERROR--2
Exception stack is:
1. Too many open files (java.net.SocketException) sun.nio.ch.Net:-2 (null)
2. java.net.SocketException: Too many open files (java.util.concurrent.ExecutionException)
org.glassfish.grizzly.impl.SafeFutureImpl$Sync:349 (null)
3. java.util.concurrent.ExecutionException: java.net.SocketException: Too many open files (java.io.IOException)
org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient:223 (null)
4. Error sending HTTP request. Message payload is of type: String (org.mule.api.MessagingException)
org.mule.module.http.internal.request.DefaultHttpRequester:287 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
Root Exception stack trace:
java.net.SocketException: Too many open files
at sun.nio.ch.Net.socket0(Native Method)
at sun.nio.ch.Net.socket(Net.java:411)
at sun.nio.ch.Net.socket(Net.java:404)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
Request was accepted by http-listner and system stopped.
Maybe miss one configuration, or close connection....
(I saw same questions with solutions to increase system or add code in java class etc... - it wasn't help me, I don't have java classes. )
Someone can help me?
This is an issue with Anypoint Studio. Unfortunately your operating system can only open so many files. Depending on your operating system this limit varies, however I experienced this same issue in both Ubuntu and macOS using the latest Anypoint Studio (5 to 6).
The best thing I can suggest is to restart and try and keep your open files to a minimum at any one point whilst using Anypoint. When I'm only working on 4-5 files at a time I can usually go an entire day without needing to restart.
With heavy usage I end up needing to restart within 5 hours.

Camel XSD validation not working: Camel 2.12.1 / JBoss 5.1.0.GA / JDK 1.6

Camel validation is not working when i deploy to jboss, work perfectly with mvn jetty:run. See error below:
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: Source parameter of type 'org.apache.camel.StringSource' is not compatible with result parameter of type 'javax.xml.transform.stream.StreamResult'.
at org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
at org.apache.camel.processor.validation.ValidatingProcessor.doProcess(ValidatingProcessor.java:152)
at org.apache.camel.processor.validation.ValidatingProcessor.process(ValidatingProcessor.java:87)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
at org.apache.camel.processor.validation.ValidatingProcessor.process(ValidatingProcessor.java:82)
at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)
at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
....
Camel Route configuration below:
<camel:route id="process-xml-file" startupOrder="200">
<from uri="direct:process-xml-file"/>
<log message="processing file ${file:name}"/>
<choice>
<when>
<xpath>/invoices/#region='regionA'</xpath>
<split streaming="true" parallelProcessing="true">
<tokenize token="invoice" inheritNamespaceTagName="dataexport" xml="true"/>
<doTry>
<to uri="validator:xml/invoice.xsd"/>
<to uri="processInv"/>
<doCatch>
<exception>org.apache.camel.ValidationException</exception>
<exception>java.sql.SQLException</exception>
<setBody>
<simple>${exception.message}\n${body}</simple>
</setBody>
<to uri="direct:error-notification"/>
</doCatch>
</doTry>
</split>
</when>
<otherwise>
<log message="ignoring file ${file:name}, not 'invoice'"/>
</otherwise>
</choice>
</camel:route>
I just checked the code of
org.apache.xerces.jaxp.validation.StreamValidatorHelper and found out we can solve this issue by not setting the result type when call the validate method.
So I fill a JIRA in camel to track this issue, you can fix this issue by porting the patch or using the latest snapshot which includes the patch

Change service location on Mule

my first try was to simple proxy a service from one location to another, and it work just fine, right now i need some help in how to change part of the service location, for example, the retrieved WSDL point 4 services to a machine, i need to change 1 of those services for another server, is that even possible? If so, how do i do it?
Mule Version CE 3.4.
my code atm is as follow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ssl="http://www.mulesoft.org/schema/mule/ssl" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="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/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.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/3.4/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.4/mule-http.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.4/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.4/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.mulesoft.org/schema/mule/ssl http://www.mulesoft.org/schema/mule/ssl/current/mule-ssl.xsd" version="EE-3.4.0">
<mule-ss:security-manager>
<mule-ss:delegate-security-provider
name="memory-dao" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="asd" password="asd" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<https:connector name="httpsConnector">
<https:tls-key-store path="${mule.home}/conf/keystore.jks"
keyPassword="1234567" storePassword="1234567" />
</https:connector>
<pattern:web-service-proxy name="Service"
inboundAddress="https://LocalAdress.com:443/services/Service"
outboundAddress="http://RemoteAddress.com/services/Service.svc"
wsdlLocation="http://RemoteAddress.com/services/Service.svc?singleWSDL"/>
Mule doesn't offer a mechanism to realize this type of WSDL customization. What you have to do is:
download "http://RemoteAddress.com/services/Service.svc?singleWSDL",
customize it by hand,
embed the customized version in your project (say in "src/main/resources"),
serve it with wsdlFile="yourCustom.wsdl"

Transaction commit delay when routing message from one jms queue to another

We are trying to build simple transacted jms-to-jms router using Mule ESB and JBoss Messaging. When we run Mule ESB with application configured as below, we observe strange behaviour.
Approximately 10 messages are routed from queue test1 to test2
Nothing happens for ~40 seconds.
goto 1
Queue test1 is filled with around 500 messages when we start test. We use Mule 3.2 and JBoss 5.1.
If I remove transactions from code below everything works fine, all messages are sent to queue test2 instantly. Also, everything is fine if I change transactions from xa to jms -- by replacing xa-transaction tags with jms:transaction.
I don't know what causes this pause in message processing on ESB, probably transaction commit is delayed.
My question is: what should I do to have xa transactions working correctly?
I'll provide more details if needed. I asked this question on Mule ESB forum before with no answer http://forum.mulesoft.org/mulesoft/topics/transaction_commit_delay_when_routing_message_from_one_jms_queue_to_another
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
<jbossts:transaction-manager> </jbossts:transaction-manager>
<configuration>
<default-threading-profile maxThreadsActive="30" maxThreadsIdle="5"/>
<default-receiver-threading-profile maxThreadsActive="10" maxThreadsIdle="5"/>
</configuration>
<spring:beans>
<spring:bean id="jmsJndiTemplate" class="org.springframework.jndi.JndiTemplate" doc:name="Bean">
<spring:property name="environment">
<spring:props>
<spring:prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</spring:prop>
<spring:prop key="jnp.disableDiscovery">true</spring:prop>
<spring:prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</spring:prop>
<spring:prop key="java.naming.provider.url">localhost:1099</spring:prop>
</spring:props>
</spring:property>
</spring:bean>
<spring:bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" doc:name="Bean">
<spring:property name="jndiTemplate">
<spring:ref bean="jmsJndiTemplate"/>
</spring:property>
<spring:property name="jndiName">
<spring:value>XAConnectionFactory</spring:value>
</spring:property>
</spring:bean>
</spring:beans>
<jms:connector name="JMS" specification="1.1" numberOfConsumers="10" connectionFactory-ref="jmsConnectionFactory" doc:name="JMS"/>
<flow name="flow" doc:name="flow">
<jms:inbound-endpoint queue="test1" connector-ref="JMS" doc:name="qt1">
<xa-transaction action="ALWAYS_BEGIN"/>
</jms:inbound-endpoint>
<echo-component doc:name="Echo"/>
<jms:outbound-endpoint queue="test2" connector-ref="JMS" doc:name="qt2">
<xa-transaction action="ALWAYS_JOIN"/>
</jms:outbound-endpoint>
<echo-component doc:name="Echo"/>
</flow>
</mule>
Here you can find log fragment for 1 message interaction. Please note that in this case there was no delay.
And here is log fragment for 11 messages. All of them were in queue test1 when app started, as you can see 10 messages are routed instantly and one is delayed by 1 minute.
I've found root of my problem: my queues were defined with following attribute:
<attribute name="RedeliveryDelay">60000</attribute>
Removing it or setting low value solves my problem with delays. Problem is, I don't know why :)
I always thought that redelivery delay is used when delivery fails, which was not the case in my app.