简体   繁体   中英

VM endpoint is not invoked

The payload doesn't get routed to the Global outbound queue jms://orders-queue. It is commented out in the flow. However, when I use the flow-ref=process-orders the message gets dispatched to the process-orders flow. Why does dispatching throught the vm not work?

    <vm:endpoint name="orders-queue" path="email.orders.in" exchange-       pattern="one-way" doc:name="VM"/>


         <vm:endpoint name="events-queue" path="email.orders.in" exchange-pattern="one-way" doc:name="VM"/>

<flow name="order-flow" processingStrategy="synchronous">
        <vm:inbound-endpoint exchange-pattern="one-way" path="order-process.queue1" doc:name="VM" />
    <!--<vm:outbound-endpoint exchange-pattern="one-way" ref="email.orders.in" doc:name="VM"/>-->
    <flow-ref name="process-orders" />
              <catch-exception-strategy doc:name="Processing Exception">
        <logger
            message="Error  during  flow - #[message] :: ExceptionSummary::= #[exception.summaryMessage]"
            level="ERROR" doc:name="Logger" />
    </catch-exception-strategy>
</flow>


<flow name="process-orders" processingStrategy="synchronous">
    <vm:inbound-endpoint exchange-pattern="one-way" ref="email.orders.in" doc:name="VM"/>
    <custom-transformer class="com.sw.CustomTransformer" doc:name="Java"/>

    <logger message="Received Order : #[payload]" level="DEBUG" doc:name="Logger"/>
        <foreach collection="#[message.payload]" doc:name="For Each"
            rootMessageVariableName="Original">
            <flow-ref name="process.order" doc:name="Flow Reference"/>
        </foreach>
</flow>

<sub-flow name="process.order">
    <processor-chain doc:name="Processor Chain" name="Event_Process_Queueing">
        <jms:outbound-endpoint queue="per.order.queue" 
            connector-ref="jmsConnector" doc:name="JMS - Send to Processing Queue"/>
    <test:component/>       
    </processor-chain>
   </sub-flow>

There are few mistakes in your config :-
First process.order is not a flow but a sub-flow and you cannot keep a inbound VM endpoint in a sub-flow to call it.
So,inorder to route the payload through the Global VM queue which you configured email.orders.in you can follow the follow config example:-

    <vm:endpoint name="orders-queue" path="email.orders.in" exchange-pattern="one-way" doc:name="VM"/>
    <http:listener-config name="HTTP_Listener_Configuration2" host="localhost" port="8081"  doc:name="HTTP Listener Configuration" />

    <flow name="Flow">
        <http:listener config-ref="HTTP_Listener_Configuration2" path="/test" doc:name="HTTP"/>
        <set-payload value="Test payload" doc:name="Set Payload"/>
        <vm:outbound-endpoint exchange-pattern="one-way" ref="orders-queue" doc:name="VM"/>
    </flow>

    <flow name="Flow2">
        <vm:inbound-endpoint exchange-pattern="one-way" ref="orders-queue"  doc:name="VM"/>
      <logger message="Received Message in Processing Queue : #[payload]" level="INFO" doc:name="Logger" />
    </flow>

UPDATE:-

As per your comment below, you are making major mistake in referring your VM inbound and outbound endpoint with Global VM connector.
It should be as follows:-

 <vm:outbound-endpoint exchange-pattern="one-way" ref="events-queue" doc:name="VM"/>  

and

 <vm:inbound-endpoint exchange-pattern="one-way" ref="events-queue" doc:name="VM"/>

You are referring ref="email.orders.in" which is wrong and should be ref="events-queue" as mentioned above with the name of Global VM connector

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM