ftp - mulesoft, loop over a properties file and start inbound endpoints -
i working on mule flow need read properties file have multiple organizations ftp endpoints. whenever flow starts, should iterate on property file , start consuming data different ftp endpoints. sample property file:
organizations: orga: ftpendpoint: sftp://{orgauser}:{password}@{hosta}:22/incoming/test orgb: ftpendpoint: sftp://{orgbuser}:{password}@{hostb}:22/incoming/test
i want understand how iterate on yaml property file? code snippet appreciated. also, read in mulesoft document cannot put inbound endpoint in foreach loop. if case how can achieve this?
thanks & regards, vikas gite
i want understand how iterate on yaml property file
reading config file (yaml):
<context:property-placeholder properties-ref="myconfig" /> <spring:beans> <spring:bean id="myconfig" class="org.springframework.beans.factory.config.yamlpropertiesfactorybean"> <spring:property name="resources" value="classpath:config.yaml"/> </spring:bean> </spring:beans>
and here java component iterates on entries:
public class configexample implements initialisable { private properties props; @override public void initialise() throws initialisationexception { props.entryset().foreach(entry -> { // ever want configuration entries. // example system.out.println :) system.out.println(entry.getkey() + ": " + entry.getvalue()); }); } public properties getprops() { return props; } public void setprops(properties props) { this.props = props; } }
inject myconfig
in configexample
:
<spring:beans> <spring:bean class="configexample"> <spring:property name="props" ref="myconfig" /> </spring:bean> </spring:beans>
also, read in mulesoft document cannot put inbound endpoint in foreach loop. if case how can achieve this?
that right, wont able iterate on inbound endpoints, can create flows inbound endpoints , start them based on configuration. here faraz masood describes how it.
Comments
Post a Comment