Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Until Successful Component


Published on

How to use Until Successful Component

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Until Successful Component

  1. 1. Until Successful Component 20-12-2015
  2. 2. Abstract • The main motto of this PPT is how to use Until Successful component in our applications.
  3. 3. Introduction • The until-successful scope processes messages through the processors within it until the process succeeds. By default, until- successful’s processing occurs asynchronously from the main flow. After passing a message into the until-successful scope, the main flow immediately regains control of the thread. However, you can configure until-successful to run synchronously relative to the main flow.
  4. 4. Example
  5. 5. • .mflow• <?xml version="1.0" encoding="UTF-8"?> • <mule xmlns:vm="" xmlns:jdbc-ee="" xmlns:http="" xmlns="" xmlns:doc="" xmlns:spring="" version="EE-3.4.0" xmlns:xsi="" xsi:schemaLocation=" • • • •"> • <jdbc-ee:mssql-data-source name="MS_SQL_Data_Source" user=“****" password=“****" url="jdbc:sqlserver://localhost;databaseName=test1" transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source"/> • <jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/> • <spring:beans> • <spring:bean id="Bean" name="Bean" class=""/> • </spring:beans> • <flow name="Database_ComponentFlow2" doc:name="Database_ComponentFlow2"> • <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8087" path="UntilSuccessful" doc:name="HTTP"/> • <logger message="--main flow--" level="INFO" doc:name="Logger"/> • <expression-component doc:name="Expression"><![CDATA[ • sessionVars['DB_STATUS']='INITIAL'; • ]]></expression-component> • <until-successful objectStore-ref="Bean" maxRetries="5" secondsBetweenRetries="5" doc:name="Until Successful" failureExpression="#[sessionVars['DB_STATUS']!='SUCCESS']"> • <vm:outbound-endpoint exchange-pattern="request-response" path="db" doc:name="VM"/> • </until-successful> • </flow> • <flow name="Database_ComponentFlow3" doc:name="Database_ComponentFlow3"> • <vm:inbound-endpoint exchange-pattern="request-response" path="db" doc:name="VM"/> • <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="select" queryTimeout="-1" connector-ref="Database" doc:name="Database"> • <jdbc-ee:query key="select" value="select * from mytable1"/> • </jdbc-ee:outbound-endpoint> • <expression-component doc:name="Expression"><![CDATA[ • sessionVars['DB_STATUS']='SUCCESS'; • ]]></expression-component> • <logger message="--success" level="INFO" doc:name="Logger"/> • </flow> • </mule>
  6. 6. • Output:
  7. 7. • Flow of execution: 1. URL to trigger the service from browser http://localhost:8087/UntilSuccessful 2. Database component connects to the specific database, executes the select query but there is no table specified in DB, hence the until successful component retries for 5 times and exit the flow.
  8. 8. References • guide/v/3.5/until-successful-scope