Advertisement
Guest User

Untitled

a guest
Mar 4th, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <asynchronous-processing-strategy name="500Threads" maxThreads="500"/>
  2.  
  3. <flow name="work2In">
  4. <description>
  5. <![CDATA[
  6. Work-2 Demo.
  7.  
  8. This demonstrates an synchronous HTTP request -> asynchronous splitter, processing, and aggregation, back to the original
  9. synchronous HTTP reply.
  10.  
  11. The message payload is transformed into a collection (list) of 500 elements, which is sent to the work2request asynchronous VM. The
  12. synchronous HTTP thread waits for a single message to arrive over the work2reply asynchronous VM endpoint.
  13.  
  14. Upon the single message arriving on the work2request VM inbound endpoint, the message is split into 500 individual messages via the
  15. collection splitter, and each message is sent to the asynchronous flow work2worker. The flow work2worker will execute asynchronously,
  16. based on its processing model. Each message has its payload replaced with the respective message correlation id, which is transformed
  17. to demonstrate a content change. The message is then sent to work2workreply asynchronous VM endpoint.
  18.  
  19. The work2workreply VM endpoint aggregates each message back into the original collection (unsorted), which is send back to the HTTP
  20. synchronous thread via the work2reply VM endpoint.
  21. ]]>
  22. </description>
  23.  
  24. <http:inbound-endpoint name="httpWork2In"
  25. host="127.0.0.1" port="8080"
  26. path="work-2" exchange-pattern="request-response">
  27. </http:inbound-endpoint>
  28.  
  29. <expression-transformer evaluator="groovy" expression="1..500"/>
  30.  
  31. <request-reply storePrefix="work2Store">
  32. <vm:outbound-endpoint path="work2request">
  33. <message-properties-transformer scope="outbound">
  34. <delete-message-property key="MULE_REPLYTO"/>
  35. </message-properties-transformer>
  36. </vm:outbound-endpoint>
  37. <vm:inbound-endpoint path="work2reply" exchange-pattern="one-way"/>
  38. </request-reply>
  39.  
  40. <logger message="Final payload: #[groovy:payload.size()] elements" level="ERROR"/>
  41. <logger message="Final payload: #[payload]" level="ERROR"/>
  42.  
  43. <json:object-to-json-transformer/>
  44.  
  45. <logger message="Done." level="ERROR"/>
  46. </flow>
  47.  
  48. <flow name="work2dispatcher">
  49. <vm:inbound-endpoint path="work2request" exchange-pattern="one-way"/>
  50. <collection-splitter/>
  51. <flow-ref name="work2worker"/>
  52. </flow>
  53.  
  54. <flow name="work2aggregator" processingStrategy="500Threads">
  55. <vm:inbound-endpoint path="work2workreply" exchange-pattern="one-way"/>
  56.  
  57. <collection-aggregator/>
  58. <combine-collections-transformer/>
  59.  
  60. <logger message="Aggregated payload: #[groovy:payload.size()] elements" level="ERROR"/>
  61. <logger message="Aggregated payload: #[payload]" level="ERROR"/>
  62.  
  63. <vm:outbound-endpoint path="work2reply" exchange-pattern="one-way"/>
  64. </flow>
  65.  
  66. <flow name="work2worker" processingStrategy="500Threads">
  67. <expression-transformer evaluator="message" expression="correlationSequence"/>
  68. <logger message="ID: #[payload]" level="ERROR"/>
  69. <transformer ref="multiplier"/>
  70. <vm:outbound-endpoint path="work2workreply" exchange-pattern="one-way"/>
  71. </flow>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement