Mule config schema don't have logger - mule

I have a little question about mule xml config file,while I try simple mule app that using logger and expression.The config file be like this :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1"
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-3.1.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<flow name="basic_tutorialFlow1" doc:name="basic_tutorialFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" doc:name="HTTP"/>
<expression-filter expression="#[message.payload != '/favicon.ico']" doc:name="Expression"></expression-filter>
<logger level="INFO" doc:name="Logger" message="Current payload is #[message.payload]"/>
<set-payload doc:name="Set Payload" value="#['Hello, ' + message.payload + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]"/>
</flow>
I have error on expression-filter and logger. The error shown like this :
cvc-complex-type.2.4.a: Invalid content was found starting with element 'expression-filter'
The program can running but I don't feel right when the project still have error.I want to know how to fix this.
I check http://www.mulesoft.org/schema/mule/ but don't see expression-filter or logger.
my editor is STS 3.4.0 and mule version is 3.4 ,Thank you.

I'd recommend changing your schema locations to name your explicit version, e.g.
xsi:schemaLocation="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"
and also the xmlns statements, similarly. I've experienced this with mule 3.2.x, where certain XML attributes would fail to resolve in Mule IDE, although they compiled just fine. Changing from "current" to my specific version often corrected these resolution errors (although not always).
In general, it's usually safe to ignore these resolution failures if compilation and execution succeeds, but I agree with your general assertion that it's not a good feeling. Try being explicit with your schema definition, as I searched the core mule.xsd and both logger and expression-filter are properly defined in that file, so that should resolve your resolution errors.

Related

mule standalone 3.7.0: error deploying mule app

I am trying to deploy a mule app via mule standalone 3.7.0 but I'm getting an error, even though it works perfect via anypoint studio version 5.4.1 using 3.7.2 mule server. note: I have created a zip folder via anypoint studio.
This is my flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:amqp="http://www.mulesoft.org/schema/mule/amqp" 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"
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/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/current/mule-magento.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/amqp http://www.mulesoft.org/schema/mule/amqp/current/mule-amqp.xsd">
<amqp:connector name="AMQPConnector"
validateConnections="true"
doc:name="AMQPConnector"
/>
<magento:config name="Magento" username="test" password="test" address="http://127.0.0.1:8000/api/v2_soap/" doc:name="Magento"/>
<flow name="flow">
<amqp:inbound-endpoint queueName="test" responseTimeout="10000" exchange-pattern="request-response" connector-ref="AMQPConnector" doc:name="AMQP-0-9" exchangeType="topic"/>
<logger message="test!!" level="INFO" doc:name="Logger"/>
<magento:get-product config-ref="Magento" productId="1" doc:name="Magento">
<magento:attributes-names>
<magento:attributes-name>sku</magento:attributes-name>
</magento:attributes-names>
</magento:get-product>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<set-payload value="payload: #[payload]" doc:name="Set Payload"/>
</flow>
</mule>
This is he error:
ERROR 2016-01-10 18:40:46,877 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.DefaultArchiveDeployer:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Failed to deploy artifact 'alone', see below +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
org.mule.module.launcher.DeploymentInitException: SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'amqp:connector'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":description, "http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/context":property-placeholder, "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector, "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, "http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter, "http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor, "http://www.mulesoft.org/schema/mule/core":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core":invoke, "http://www.mulesoft.org/schema/mule/core":set-payload, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, "http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' is expected.
Any ideas how to fix?
You are probally missing the dependency for the AMQP connector in your POM if you have a maven project.
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-amqp</artifactId>
<version>x.y.z</version>
</dependency>
Hope this helps
As stated above, you are probably missing activemq connector jar files, if you are using maven, place it on your pom and let it download the prescribed version for example:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.13.2</version>
</dependency>
http://activemq.apache.org/download.html
Hope this helps.
Hi i think amqp:connector is not present in your AnyPoint studio.
Go thru Help --> Install new Sofware --> select Anypoint Connectors Update Site - http://repository.mulesoft.org/connectors/releases/3.5.0.
Hope this helps as mentioned by others above.
This Error is thrown because ampq:connector is used in your flow, not installed in your setup.
To install ampq:connector , go to Help-> Install new Software -> http://repository.mulesoft.org/connectors/releases/3.5.0
and install following package from the list.
Than install Mule AMPQ Tranpost package and restart your Anypoint Studio.
This will solve your Problem.
Try changing your namespace reference from current to:
"http://www.mulesoft.org/schema/mule/amqp/3.1/mule-amqp.xsd".
You could also refer to:
https://docs.mulesoft.com/mule-user-guide/v/3.7/activemq-integration
i think amqp:connector is not present in your AnyPoint studio. try to download it in Studio by following steps.
Help --> Install new Sofware --> select Anypoint Connectors Update Site - http://repository.mulesoft.org/connectors/releases/3.5.0.
restart the studio...done..!!! please let me know if it helps.
Most likely the connector dependency is missing from the Mule project descriptor file, called mule-project.xml. This prevents Studio from attaching the proper connector JARs to the app, causing the Invalid content was found starting with element 'amqp:connector exception you experienced.
All connectors used by the app are declared in mule-project.xml inside a <muleExtension> tag:
<muleExtension name="AMQP-0-9" qualifier="mule-transport-amqp-contribution"/>
With dependency:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mule-project xmlns="http://www.mulesoft.com/tooling/project" runtimeId="org.mule.tooling.server.3.7.3.ee" schemaVersion="5.3.0.0">
<name>demo-amqp</name>
<description></description>
<muleExtension name="AMQP-0-9" qualifier="mule-transport-amqp-contribution"/>
</mule-project>
Without dependency:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mule-project xmlns="http://www.mulesoft.com/tooling/project" runtimeId="org.mule.tooling.server.3.7.3.ee" schemaVersion="5.3.0.0">
<name>demo-amqp</name>
<description></description>
</mule-project>
Solution 1 (from Studio)
Drag & drop the connector onto the canvas. This will force an update of the Mule app, automatically adding the dependency to the project's classpath.
Solution 2 (from Studio)
Manually add the connector dependency to the classpath:
Right-click on the project and navigate through Build Path > Configure Build Path.
Select the Libraries tab.
Click Add Library button > Anypoint Connector Dependencies
Select the desired connector/s and click Finish.
i think amqp:connector is not present in your AnyPoint studio. try to download it in Studio by following steps. Help --> Install new Sofware --> select Anypoint Connectors Update Site - http://repository.mulesoft.org/connectors/releases/3.5.0.
you are probably missing activemq connector jar files
looks like amqp:connector is not present in your AnyPoint studio. try to download it in Studio by following steps. Help --> Install new Sofware --> select Anypoint Connectors Update Site - http://repository.mulesoft.org/connectors/releases/3.5.0.
restart the studio...done..!!! please let me know if it helps.

mule Config for app not found

I have mule flow, trying to deploy it, it says that "Config for app not found"
I have created a dummy mule-config.xml under src/main/app, given below. My flow is:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey" 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" version="EE-3.4.1" 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/jersey http://www.mulesoft.org/schema/mule/jersey/current/mule-jersey.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">
<flow name="webservicesFlow1" doc:name="webservicesFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="slmule2.corp.local" port="8088" path="rest" doc:name="HTTP"/>
<jersey:resources doc:name="REST">
<component class="com.rest.sample.RestComponent"/>
</jersey:resources>
</flow>
</mule>
mule-deploy.properties
redeployment.enabled=true
encoding=UTF-8
domain=default
config.resources=webservices.xml
mule-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd">
<!-- empty config to avoid the hot deployment classloader choking on a missing config file -->
</mule>
Error message:
ERROR 2014-06-12 12:58:06,575 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.MuleDeploymentService:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Failed to deploy app + +
'webservices-1.0.0-SNAPSHOT-v20140612-12+57', + + see below +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
org.mule.module.launcher.InstallException: Config for app 'historydata-1.0.0-SNAPSHOT-
v20140612-12+57' not found: /apps/mulesoft/mule-enterprise-standalone-3.4.2/apps
/webservices-1.0.0-SNAPSHOT-v20140612-12+57/webservices.xml at
org.mule.module.launcher.application.DefaultMuleApplication.install(DefaultMuleApplication.j
ava:107) at
org.mule.module.launcher.application.ApplicationWrapper.install(ApplicationWrapper.java:79)
at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:42) at
org.mule.module.launcher.MuleDeploymentService.guardedDeploy(MuleDeploymentService.java:454)
at
org.mule.module.launcher.MuleDeploymentService.deployApplication(MuleDeploymentService.java:
191) at
org.mule.module.launcher.MuleDeploymentService.deployExplodedApp(MuleDeploymentService.java:
708) at
org.mule.module.launcher.MuleDeploymentService.deployExplodedApps(MuleDeploymentService.java
:661) at
org.mule.module.launcher.MuleDeploymentService.access$400(MuleDeploymentService.java:57) at
org.mule.module.launcher.MuleDeploymentService$AppDirWatcher.run(MuleDeploymentService.java:
808) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThr
eadPoolExecutor.java:178) at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPool
Executor.java:293) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at
java.lang.Thread.run(Thread.java:744) INFO 2014-06-12 12:58:07,859 [2132436410#qtp-
1158879031-6] org.mule.module.launcher.MuleDeploymentService: ================== Request to
Undeploy Application: ambrosehistorydata-1.0.0-SNAPSHOT-v20140612-12+57 INFO 2014-06-12
12:58:07,860 [2132436410#qtp-1158879031-6]
org.mule.module.launcher.application.DefaultMuleApplication: App 'webservices-1.0.0-
SNAPSHOT-v20140612-12+57' never started, nothing to dispose of INFO 2014-0
I am using mule studio 3.5.0 and mule-ee 3.4.
I had the same problem.
when you build your zip, you should zip files, not a directory ...
Dan
Sometimes javaw.exe doesn't seem to let go of a running project and seems to lock access to the config file. Killing javaw.exe and rerunning the project again fixed it.
In your Mule configuration file (src/main/app/app-config-file.xml), you can specify the properties file you want to load.
<context:property-placeholder location="${environment.name}.properties" />
This is the description of the attribute location :
Attribute : location
The location of the properties file to resolve placeholders against,
as a Spring resource location: a URL, a "classpath:" pseudo URL, or
a relative file path. Multiple locations may be specified, separated
by commas. If neither location nor properties-ref is specified,
placeholders will be resolved against system properties.
${environment.name} must be a system environment variable. You need to make sure the system where you are deploying your app contains that variable. I think you can also specify it in the Maven build, if you are using Maven (clean install -Denvironment.name=test). You can try.
To test locally, right click on your project, select run as, select run configurations, click on Environment tab, add your variable "environment.name" and the value "local" (without quotation marks) and make sure your local.properties file exists in a location added to the build path. It can be src/main/app for example or in the resources folder.
I had the same problem too.
My solution, i believe, was simpler.
Instead of exporting the project somehow and then try to deploy it by uploading a zipped file through the browser, I deployed it through Anypoint studio itself.
Right click on the project
Anypoint platform
Deploy to cloud
Sign in with your credentials (if not signed in already)
Choose the proper application and runtime environment then hit deploy.

MUnit Configuration error

I have sample Munit Test case in My Mule Project. But the file always showing an error mark at <munit:config> tag at the start of the configuration file.
Note: But currently I'm able to execute my munit test cases.
The error is:
cvc-complex-type.2.4.a: Invalid content was found starting with
element 'munit:config'. One of
'{"http://www.mulesoft.org/schema/mule/core":annotations,
"http://www.mulesoft.org/schema/mule/core":description,
This is an old post, but I don't see an answer. I had the same issue:
I had
at the top of declarations. I deleted it since I also had
xmlns:core="http://www.mulesoft.org/schema/mule/core" below.
This fixed the error.
This error means that the munit jars are not in your classpath
check for duplicate names of files, or flow names.
even if the files are in different folders or packages.
make them unique no matter what !
To help anyone else and the future me who still face this issue in Anypoint Studio 6.5 and munit tools 3.9.0 we had to configure the munit configuration global element as follows
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:munit="http://www.mulesoft.org/schema/mule/munit" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tls="http://www.mulesoft.org/schema/mule/tls" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:mock="http://www.mulesoft.org/schema/mule/mock" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.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/tls http://www.mulesoft.org/schema/mule/tls/current/mule-tls.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/mock http://www.mulesoft.org/schema/mule/mock/current/mule-mock.xsd">
<munit:config mock-connectors="false" mock-inbounds="false" name="munit"
doc:name="MUnit configuration"/>
<spring:beans>
<spring:import resource="classpath:insurer-sys-api.xml"/>
<spring:import resource="classpath:global.xml"/>
<spring:import resource="classpath:insurer-sys-api-claims.xml"/>
<spring:import resource="classpath:insurer-sys-api-policyValidation.xml"/>
<spring:import resource="classpath:insurer-ctp-sys-api-shared.xml"/>
<spring:import resource="classpath:insurer-ctp-sys-api-health.xml"/>
</spring:beans>
<http:request-config name="HTTPS_Request_Configuration" protocol="HTTPS"
host="localhost" port="8082" basePath="/api" doc:name="HTTP Request
Configuration">
<tls:context>
<tls:trust-store insecure="true"/>
</tls:context>
</http:request-config>

MuleStudio file deleted while simple renaming

In MuleStudio a simple rename script deletes files after a while. This is how the script looks like:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp" xmlns:file="http://www.mulesoft.org/schema/mule/file" 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="CE-3.4.0"
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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/current/mule-ftp.xsd">
<flow name="ftp_ping_pong_testFlow1" doc:name="ftp_ping_pong_testFlow1" initialState="started" processingStrategy="queued-asynchronous">
<file:inbound-endpoint path="C:\ftp_ping_pong_test\src\test\in\" responseTimeout="10000" doc:name="File" fileAge="1000" pollingFrequency="1200">
<file:filename-regex-filter pattern="^.*\.csv$" caseSensitive="true"/>
</file:inbound-endpoint>
<file:outbound-endpoint path="C:\ftp_ping_pong_test\src\test\in\" outputPattern="#[message.inboundProperties['originalFilename']].temp" responseTimeout="10000" doc:name="File"/>
</flow>
<flow name="ftp_ping_pong_testFlow2" doc:name="ftp_ping_pong_testFlow2">
<file:inbound-endpoint path="C:\ftp_ping_pong_test\src\test\in\" responseTimeout="10000" doc:name="File" fileAge="1000" pollingFrequency="1200">
<file:filename-regex-filter pattern="^.*\.temp$" caseSensitive="true"/>
</file:inbound-endpoint>
<file:outbound-endpoint path="C:\ftp_ping_pong_test\src\test\in\" outputPattern="#[message.inboundProperties['originalFilename'].replace('.temp','')]" responseTimeout="10000" doc:name="File"/>
</flow>
</mule>
The script does nothing else but renames the file, than names it back. It makes no difference if I raise the fileAge or if I change the processing strategy or if I run it in MuleStudio or Mule Standalone. What is strange that it works for ~300 iterations but then it gets confused.
The error log what I get looks like:
WARN 2013-12-19 12:43:15,815 [Finalizer] org.mule.transport.file.FileMessageReceiver: Failure trying to remove file C:\ftp_ping_pong_test\src\test\in\145278.csv.temp from list of files under processing
I have already lost a week with this issue, so any help would be much appreciated :)
Update:
I created two different apps. Here they are:
<?xml version="1.0" encoding="UTF-8"?>
<mule Links removed by Stackoverflow">
<file:connector name="File_Connector_CSV" autoDelete="true" streaming="false" validateConnections="true" doc:name="File" readFromDirectory="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\in" writeToDirectory="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\out"/>
<flow name="ftp_ping_pong_testFlow1" doc:name="ftp_ping_pong_testFlow1" initialState="started" processingStrategy="synchronous">
<file:inbound-endpoint path="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\in\" responseTimeout="10000" doc:name="File" fileAge="1000" pollingFrequency="1200" connector-ref="File_Connector_CSV" >
<file:filename-regex-filter pattern="^.*\.csv$" caseSensitive="true"/>
</file:inbound-endpoint>
<file:outbound-endpoint outputPattern="#[message.inboundProperties['originalFilename']].temp" responseTimeout="10000" doc:name="File" path="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\out"/>
</flow>
</mule>
And the second:
<?xml version="1.0" encoding="UTF-8"?>
<mule links removed by Stackoverflow">
<file:connector name="File" writeToDirectory="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\in" readFromDirectory="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\out" autoDelete="true" streaming="false" validateConnections="true" doc:name="File"/>
<flow name="ftp_ping_pong_player2Flow1" doc:name="ftp_ping_pong_player2Flow1">
<file:inbound-endpoint path="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\out" responseTimeout="10000" doc:name="File" connector-ref="File">
<file:filename-regex-filter pattern="^.*\.temp$" caseSensitive="true"/>
</file:inbound-endpoint>
<file:outbound-endpoint path="C:\Users\gabor.bodo\MuleStudio\workspace\ftp_ping_pong_test\src\test\in\" outputPattern="#[message.inboundProperties['originalFilename'].replace('.temp','')]" responseTimeout="10000" doc:name="File" connector-ref="File"/>
</flow>
</mule>
I ran the test with 7 test files, and as usual the files started to disappear. From the combine logs, here is the last appearance of one of the files:
INFO 2013-12-20 17:58:13,843 [[ping_pong_player1].File_Connector_CSV.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\ftp_ping_pong_test\src\test\in\09.csv
INFO 2013-12-20 17:58:14,519 [[ping_pong_player1].File_Connector_CSV.receiver.01] org.mule.transport.file.FileConnector: Writing file to: C:\ftp_ping_pong_test\src\test\out\09.csv.temp
INFO 2013-12-20 17:58:14,812 [[ping_pong_player2].File.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\ftp_ping_pong_test\src\test\out\09.csv.temp
INFO 2013-12-20 17:58:15,437 [[ping_pong_player2].File.dispatcher.402] org.mule.transport.file.FileConnector: Writing file to: C:\ftp_ping_pong_test\src\test\in\09.csv
After these log entries this file simply disappeared without any no further trace in logs.
I have observed that even if in MuleStudio there is a default value defined for File Age, the value is not represented in the XML file, this is why Player2, has no File Age defined.
I can about a possible scenario:
- Player1, reads the csv file and creates the temp. Player 2 reads the temp and writes back the csv. Player1 deletes the csv, believing it is still the original file. In this case Player1 is too slow, lets Player2 intervene and this can happen if Player2 has no File Age. - I have to retest this with File Age value settings accordingly.But it does not explain why happens this very rarely.
Thanks,
Gabor
Update
I know your feeling. When you add the File Connector, uncheck Auto Delete in the General tab:
Finally, I managed to figure out what was the problem after countless of experiments.
It seems that when mule is launching an application the File Age property will be checked only once, and not for each flow separately (maybe it is normal but I did not expect this behaviour). Even with different flows, it doesn't matter what is the File Age property as long as it is less than the standard kick time of Mule (says 5000 ms, but actually it is 50000 ms - someone added one zero in plus somewhere).
So what happened, that Player1 and Player2 were always trying to read, copy and delete all the files in the same time. It was just a question of when until the scenario described by me above happened.
The solution now works well, by making two separate applications with big enough FileAge (Attention that it is not enough that you have a FileAge defined in MuleStudio, it has to be in the XML as well!).
Hope it saves time for someone and thanks for all the good intention!

Mule - Unable to find type org.apache.activemq

I am using Mule Studio 3.4 and would like to experiment with Active Mq. I understood that ActiveMq is embedded in Mule, so it's not necessary to add jars on the classpath, by the way activeMq classes cannot be found on the classpath. Where am I wrong?
Here you are my configuration (copied from http://www.mulesoft.org/mule-activemq-integration-examples):
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
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/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-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<spring:beans>
<spring:bean id="AmqDeadLetterStrategy"
class="org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy"
p:queuePrefix="DLQ." />
<spring:bean id="AmqDefaultPolicyEntry"
class="org.apache.activemq.broker.region.policy.PolicyEntry"
p:queue="jobs.*"
p:deadLetterStrategy-ref="AmqDeadLetterStrategy" />
<spring:bean id="AmqPolicyMap"
class="org.apache.activemq.broker.region.policy.PolicyMap"
p:defaultEntry-ref="AmqDefaultPolicyEntry" />
<spring:bean name="AmqBroker"
class="org.apache.activemq.broker.BrokerService"
p:brokerName="esb-amq-broker"
p:persistent="true"
p:dataDirectory="${activemq.data.dir}"
p:useJmx="true"
p:useShutdownHook="false"
p:destinationPolicy-ref="AmqPolicyMap"
init-method="start"
destroy-method="stop" />
<spring:bean name="AmqRedeliveryPolicy"
class="org.apache.activemq.RedeliveryPolicy"
p:useExponentialBackOff="true" />
<spring:bean name="AmqConnectionFactory"
class="org.apache.activemq.spring.ActiveMQConnectionFactory"
p:brokerURL="vm://esb-amq-broker"
p:redeliveryPolicy-ref="AmqRedeliveryPolicy"
depends-on="AmqBroker" />
</spring:beans>
<jms:activemq-connector name="EsbJmsConnector"
specification="1.1"
connectionFactory-ref="AmqConnectionFactory"
disableTemporaryReplyToDestinations="true"
persistentDelivery="true" />
</mule>
The errors are "Unable to find type org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy on build path of project..." and similar others.
Thanks!
Mule does not bundle activemq jars, nor the ones for any JMS broker, therefor you will need either to add it manually to your project or to the ${studio.home}/plugins/org.mule.tooling.server.${mule.version}_${mule.version}.${time.stamp}/mule/user if you want the container to provide it.