当前位置: 首页 > 知识库问答 >
问题:

无法将文件发布到mule中选项内的httpendpoint

易阳朔
2023-03-14

这是我的骡子应用程序xml配置

 <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" 
 xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:test="http://www.mulesoft.org/schema/mule/test"   
xmlns:file="http://www.mulesoft.org/schema/mule/file"    
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd
http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/3.6/mule-test.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.6/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.6/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.6/mule-file.xsd">

<object-to-string-transformer name="httptoobj" />
<file:connector name="input"/>
<http:http-response-to-object-transformer
    name="httptostring" />
<configuration>
    <expression-language autoResolveVariables="false">
        <import class="com.xyz.alertcampaign.appworkflow.CampaignStatus" />
    </expression-language>
</configuration>
<flow name="polling" doc:name="polling" processingStrategy="synchronous">
    <quartz:inbound-endpoint repeatInterval="3000"
        startDelay="3000" jobName="couchbasePoller" doc:name="Quartz">
        <quartz:event-generator-job stateful="true" />
    </quartz:inbound-endpoint>
    <component doc:name="Java">
        <singleton-object
            class="com.xyz.alertcampaign.appworkflow.CouchbasePoller" />
    </component>

    <vm:outbound-endpoint exchange-pattern="one-way"
        path="oozieQueue" doc:name="Trigger workflow" />

</flow>
<flow name="oozie-workflow-manager" doc:name="oozie-workflow-manager">
    <vm:inbound-endpoint exchange-pattern="one-way"
        path="oozieQueue" doc:name="VM" />

    <foreach collection="#[payload.items()]" counterVariableName="counter">
        <choice doc:name="Choice">
            <when expression="#[payload.status == CampaignStatus.NOT_STARTED]">
                <file:inbound-endpoint address="file://#[payload.fileName]" connector-ref="input"/>             
                <http:outbound-endpoint exchange-pattern="request-response"
                    address="http://localhost:8080/oozie/v1/jobs"
                    responseTransformer-refs="httptoobj" method="POST" doc:name="HTTP"
                    contentType="application/xml;charset=UTF-8" />
                <choice doc:name="Choice">
                    <when expression="#[message.inboundProperties['http.status'] == 201]">
                        <component doc:name="Java">
                            <singleton-object
                                class="com.xyz.alertcampaign.appworkflow.JobUpdater" />
                        </component>
                    </when>
                    <otherwise>
                        <logger level="ERROR" message="Error occurred on creating Job in OOzie " />
                    </otherwise>
                </choice>
            </when>
            <when
                expression="#[payload.status == CampaignStatus.UPDATED || payload.status == CampaignStatus.EXPIRED]">
                <logger level="ERROR" message="#[payload.status]" />
                <http:outbound-endpoint exchange-pattern="request-response"
                    method="PUT"
                    address="http://localhost:8080/oozie/v1/job/#[payload.jobId]?action=kill"
                    responseTransformer-refs="httptoobj" doc:name="HTTP" />
                <choice doc:name="Choice">
                    <when expression="#[message.inboundProperties['http.status'] == 200]">
                        <component doc:name="Java">
                            <singleton-object
                                class="com.xyz.alertcampaign.appworkflow.JobUpdater" />
                        </component>
                    </when>
                    <otherwise>
                        <logger level="ERROR" message="Error occurred on killing Job in OOzie " />
                    </otherwise>
                </choice>
            </when>
        </choice>
    </foreach>
</flow>

</mule> 

获取以下异常(堆栈):

加载mule' xml:时出现异常,原因是:org . XML . sax . sax parse exception:CVC-complex-type . 2.4 . a:发现以元素' file:inbound-endpoint '开头的无效内容。应为“{ http://www . mule soft . org/schema/mule/core”:abstract-message-processor,“http://www . mule soft . org/schema/mule/core”:abstract-outbound-endpoint,“http://www . mule soft . org/schema/mule/core”:abstract-mixed-content-message-processor }”中的一个。

为什么我不允许在选择路由器内发布文件到超文本传输协议?

共有3个答案

郑俊材
2023-03-14

此外,我认为还有另一个问题,即入站endpoint不允许动态输入。我通过MuleRequester解决了这个问题

仉联
2023-03-14

问题是它是一个入站endpoint,因此您要在流的中间添加一个消息源。您应该做的是定义另一个以该文件入站endpoint(具有所有逻辑)开始的流,并在其选择中使用流引用元素。有关更多详细信息,请查看文档。

强志学
2023-03-14

您只能在流的开头使用< code > file:inbound-endpoint 。如果您试图中途检索文件,那么可以考虑使用Mule Requestor模块。这允许您在流程中的任何点请求资源(即文件)。

 类似资料:
  • 当我从Visual Studio运行它时,我的Asp.NetCore 2.0 MVC应用程序运行正常 但在VisualStudio中,我确实将ASPNETCORE_ENVIRONMENT设置为Production。据我所知,环境就是生产 我的操作系统是Windows 10,IIS版本是10.0.15063.0。 程序. cs: Startup.cs: 我的csproj:我无法将其粘贴为代码,因此不

  • 更新新的jar文件后,我使用以下代码。然而在硒的早期版本中,它工作得很好。 我更新了,因为它给出了错误: 组织。openqa。硒。NoTouchElementException:找不到索引为1的选项 对于此错误的留档,请访问:http://seleniumhq.org/exceptions/no_such_element.html构建信息:版本:未知,修订版:2aa21c1,时间:2016-08-

  • 问题内容: 我已经为jenkins安装了logstash插件,并将其配置为使用索引器作为弹性搜索。 在执行作业时,我看到以下错误: 我们将提供有关如何解决此错误的任何线索。 谢谢-Prateek 问题答案: 在Jenkins插件上,您需要定义包含[yourindex] / [yourtype]的elasticsearch网址,如下所示: http:// localhost:9200 / youri

  • 问题内容: 我是Android应用程序开发的新手。请找到我的AsyncTask代码,用于在用户单击按钮时连接URL。 请参阅我的MainActivity方法: 在这里,我遇到了一个错误。我不知道我的代码有什么问题。谁能帮帮我吗 ? 问题答案: 错了 您不应创建活动类的实例。 活动由开始。 您可以将asynctask设为活动类的内部类,并在其中更新ui 或使用界面 如何从AsyncTask返回布尔值

  • 问题内容: 我知道Mule使用元素对数据的gzip压缩提供了极大的支持。但是客户端现在需要zip压缩,因为该文件必须作为zip压缩文件放在FTP上:( 在以下情况下,我在m子中遇到困难: 我创建了一个Spring bean,其中包含文件。我想使用ZipOutputStream类压缩此文件,并将其传递给我们的ftp。 这是我的流程配置: 这是我的zipCompressor的代码: 我编写了一个单元测

  • 我的 .net 应用程序在本地计算机中运行良好。我正在使用Visual Studio 2015。当我发布网站并将其上传到服务器空间时,出现以下错误。 我不明白为什么会出现这个问题。我的其他项目进展顺利。出版期间有什么问题吗? 有线索吗? 谢谢。 帕尔塔