2013-01-24 3 views
4

Я пытаюсь переместить/загружать несколько файлов из источника к месту назначения (может быть что угодно, например, FTP или File исходящая и т.д ..), используя ниже потокаКак вызвать конечную точку входа Mule из интерфейса командной строки (CLI) с помощью curl?

<flow name="flow1" doc:name="f1"> 
      <file:inbound-endpoint path="C:\input" responseTimeout="10000" doc:name="File"/> 
    </flow> 

<flow name="flow2" doc:name="f2"> 
    <http:inbound-endpoint address="http://localhost:8080" doc:name="HTTP" exchange-pattern="request-response"/> 

    <flow-ref name="flow1" doc:name="Flow Reference"/> 
     <file:outbound-endpoint path="C:\outputfile" responseTimeout="10000" doc:name="File"/> 

</flow> 

Причиной, побуждающей делать таким образом, что я хотите вызвать задание из интерфейса командной строки (CLI) с помощью CURL.

Но я получаю ошибку ниже

Ошибка:

Exception in thread "main" org.mule.module.launcher.DeploymentInitException: SAXParseException: cvc-complex-type.2.4.b: The content of element 'flow' is not complete. One of '{" http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-outbound-endpoint, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-content-message-processor, " http://www.mulesoft.org/schema/mule/core ":response}' is expected. at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:220) at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64) at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:46) at org.mule.tooling.server.application.ApplicationDeployer.run(ApplicationDeployer.java:56) at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:88) Caused by: org.mule.api.config.ConfigurationException: Line 11 in XML document from URL [file:/D:/MuleStudioExperiment/FileTransferUsingHTTP/.mule/apps/test/test.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 8; cvc-complex-type.2.4.b: The content of element 'flow' is not complete. One of '{" http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-outbound-endpoint, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-content-message-processor, " http://www.mulesoft.org/schema/mule/core ":response}' is expected. (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:80) at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:208) ... 4 more Caused by: org.mule.api.config.ConfigurationException: Line 11 in XML document from URL [file:/D:/MuleStudioExperiment/FileTransferUsingHTTP/.mule/apps/test/test.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 8; cvc-complex-type.2.4.b: The content of element 'flow' is not complete. One of '{" http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-outbound-endpoint, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-content-message-processor, " http://www.mulesoft.org/schema/mule/core ":response}' is expected. (org.mule.api.lifecycle.InitialisationException) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101) at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) ... 7 more Caused by: org.mule.api.lifecycle.InitialisationException: Line 11 in XML document from URL [file:/D:/MuleStudioExperiment/FileTransferUsingHTTP/.mule/apps/test/test.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 8; cvc-complex-type.2.4.b: The content of element 'flow' is not complete. One of '{" http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-outbound-endpoint, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-content-message-processor, " http://www.mulesoft.org/schema/mule/core ":response}' is expected. at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:117) at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116) at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) ... 11 more Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from URL [file:/D:/MuleStudioExperiment/FileTransferUsingHTTP/.mule/apps/test/test.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 8; cvc-complex-type.2.4.b: The content of element 'flow' is not complete. One of '{" http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-outbound-endpoint, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-content-message-processor, " http://www.mulesoft.org/schema/mule/core ":response}' is expected. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) at org.mule.config.spring.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:112) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436) at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89) at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109) ... 14 more Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 8; cvc-complex-type.2.4.b: The content of element 'flow' is not complete. One of '{" http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-outbound-endpoint, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-content-message-processor, " http://www.mulesoft.org/schema/mule/core ":response}' is expected. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)

Пожалуйста, помогите

ответ

2

Попробуйте

<flow name="flow1" doc:name="flow1" initialState="stopped"> 
    <file:inbound-endpoint path="C:\Input" responseTimeout="10000" doc:name="File"/> 

    <file:outbound-endpoint path="C:\outputfile" responseTimeout="10000" doc:name="File"/> 
</flow> 

<flow name="flow2" doc:name="flow2"> 
    <http:inbound-endpoint address="http://localhost:8080/start" doc:name="HTTP" exchange-pattern="request-response"/> 

    <expression-component> 
    app.registry.filePickupFlow.start(); 
    </expression-component> 

    <set-payload value="File successfully copied" /> 

</flow> 
1

Файл конечных точек ресурсов на основе конечных точек (например, FTP- и SFTP конечных точек), в отличие от конечные точки на основе событий (т.е. jms и vm) или конечные точки на основе tcp (т. е. tcp, http, udp и т. д.)

По этой причине применяемый вами подход не будет соответствовать вашему варианту использования. Если вам нужно загрузить файл по требованию (т. Е. Когда вы нажмете конечную точку http), вам необходимо реорганизовать поток и использовать mule-module-file-utils. Этот модуль необходимо добавить в качестве зависимости maven или установить в Studio. Вы можете сделать это путем клонирования git repo, а затем вы можете установить генерируемое обновление сайта архив следующими these instructions

После того, как вы сделали, что ваш поток будет выглядеть следующим образом:

<?xml version="1.0" encoding="UTF-8"?> 
<mule xmlns:fileutils="http://www.mulesoft.org/schema/mule/fileutils" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:file="http://www.mulesoft.org/schema/mule/file" 
    xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" 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.3.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/fileutils http://www.mulesoft.org/schema/mule/fileutils/3.3/mule-fileutils.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/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd 
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd "> 
    <fileutils:config name="Fileutils" doc:name="Fileutils"/> 
    <flow name="FileCopier" doc:name="FileCopier"> 
     <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="copy-file" doc:name="HTTP"/> 
     <scripting:transformer doc:name="Script"> 
      <scripting:script engine="Groovy"> 
       <scripting:text><![CDATA[def dir = new File("/" + message.getInboundProperty('http.relative.path')) 
log.info(dir.getPath()) 
return Arrays.asList(dir.listFiles())]]></scripting:text> 
      </scripting:script> 
     </scripting:transformer> 
     <logger level="INFO" doc:name="Logger"/> 
     <set-variable variableName="fileNumber" value="#[payload.size()]" doc:name="Variable"/> 
     <foreach doc:name="Foreach"> 
      <fileutils:copy-file config-ref="Fileutils" destinationName="#[message.payload.getName()]" destinationPath="/tmp/out/" fileName="#[message.payload.getName()]" filePath="#[message.payload.getParentFile().getPath()]" fileAge="0" doc:name="Fileutils"/> 
     </foreach> 
     <set-payload value="#[flowVars['fileNumber'] + ' file copied']" doc:name="Set Payload"/> 
     <http:response-builder status="200" contentType="text/plain" doc:name="HTTP Response Builder"/> 
     </flow> 
     </mule> 

Если вы не хотите использовать модуль FileUtils вы можете заменить его с компонентом сценариев, который реализует логику копирования файлов

Теперь этот поток может быть вызван, используя следующую команду локонов

локон Http: // $ { имя хоста}: 8081/копирования файлов/$ {} path_to_directory_to_copy

Документация о завитка доступна here

+0

Вопрос заключался в том, чтобы вызывать его из CLI? Не могли бы вы подробно рассказать об этом. –

+0

Добавил необходимую информацию к моему ответу – genjosanzo

+0

Исключение из потока «main» org.mule.module.launcher.DeploymentInitException: SAXParseException: префикс «file-utils» для элемента «file-utils: config» не связан. –

Смежные вопросы