从Mule中的vm队列发布到REST端点

时间:2012-12-20 22:05:00

标签: java rest java-ee esb mule

我有一个mule流接受xml并将其发布到mum中的“mailQueue”作为vm队列名称。 xml输入和mule流程如下:

<Mail>
  <Name>JonHender</Name>
  <Age>16</Age>
</Mail>

Mule_config.xml:

 <!-- This is the persistent VM connector -->
           <vm:connector name="mailQueueConnector" queueTimeout="1000">
                 <vm:queue-profile>
                <file-queue-store />
                 </vm:queue-profile>
           </vm:connector>


            <flow name="MailService">
                <https:inbound-endpoint address="https://localhost:71234/message/email"
                    method="POST"
                    exchange-pattern="request-response"
                    contentType="application/xml"/>

                <vm:outbound-endpoint path="mailQueue" connector-ref="mailQueueConnector">
                    <message-property-filter pattern="http.status=200" />
                    <logger message="INTO mailQueue" level="INFO"/>
                </vm:outbound-endpoint>

            </flow>

现在,我必须从这个“mailQueue”中读取并将其发布到REST端点(https:// localhost:71234 / messages / sendemail)。我尝试在同一个流程中添加它,但没有工作

<inbound>
    <vm:inbound-endpoint address="vm://emailBufferQueue" exchange-pattern="one-way" connector-ref="emailQueueConnector" />
</inbound>
<outbound>
    <https:outbound-endpoint address="https://localhost:71234/messages/sendemail"
</outbound>

如何从vm队列中读取并将其发布到REST端点?我可以在iam写入队列的同一个流程中执行此操作,还是应该创建新的流程?有人可以告诉我从中读取的流量并将其发送到Rest端点吗?

前进致谢和圣诞快乐你们

1 个答案:

答案 0 :(得分:2)

在另一个流程中使用mailQueue

<flow name="MailSender">
    <vm:inbound-endpoint path="mailQueue"
                         exchange-pattern="one-way"
                         connector-ref="mailQueueConnector" />
    <https:outbound-endpoint
           address="https://#[message.inboundProperties.username]:#[message.inboundProperties.password]@localhost:71234/messages/sendemail" />
</flow>