You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Kesireddy, Chandana (ITD)" <ch...@state.ma.us> on 2013/01/08 21:45:59 UTC

repeating the steps from the route

Following is the route :

public class MyRouteBuilder extends RouteBuilder {
 @Override
 public void configure() throws Exception {
      // xnc route here
  String xncFileSupport = ICEndPoints.getValue(XNC_FILE_SUPPORT);
  if (XNC_SUPPORT_ON.equalsIgnoreCase(xncFileSupport)) {
   try {
    InProcessor inproc = new InProcessor();
    String rootXncFolder = ICEndPoints.getRootXNCFolder();
      String sourceFolder =  getXNCSourceURI(pollDelayParameter,rootXncFolder);
    AgentAuthProcessor authProc = new AgentAuthProcessor();
    ConfigurationUtils utils = ConfigurationUtils.getInstance();
    Configuration config = utils.getConfig();
    String agentUserPwdUrl = MyUtils.getAgentUserPwdUrl(utils, config);
    // xnc route starts here
    from(sourceFolder)
    // the exception clause here
    .onException(Exception.class)
    .maximumRedeliveries(redeliveryCount)
    .redeliveryDelay(redeliveryDelay)
    .logHandled(true)
    .logRetryStackTrace(stackValue)
    .retryAttemptedLogLevel(LoggingLevel.WARN)
    .retriesExhaustedLogLevel(LoggingLevel.ERROR)
    .backOffMultiplier(2.0)
    .handled(true)
    .to(SEDA_XNC_EXCEPTION)
    .end()
    .process(pickupProc)
    .choice()
       .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true))
       .process(authProc)
       .to(agentUserPwdUrl)
       .otherwise()
       .process(authProc)
       .end()
    .process(inproc)
    .recipientList(header(Constants.DESTINATION_URI))
    .process(new CommandResponseProcessor()) // try using xpath here also


  }
 }
}


I want to repeat the following steps from the route  based on a condition:

 .choice()
.when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true))
.process(authProc)
.to(agentUserPwdUrl)
.otherwise()
.process(authProc)
.end()
.process(inproc)
.recipientList(header(Constants.DESTINATION_URI))

Iam using camel 2.4 , can you please suggest me how to repeat the above steps from the route based on a condition.

Thanks,
Chandana



Re: repeating the steps from the route

Posted by Christian Posta <ch...@gmail.com>.
http://camel.apache.org/loop.html


On Tue, Jan 8, 2013 at 1:45 PM, Kesireddy, Chandana (ITD) <
chandana.kesireddy@state.ma.us> wrote:

> Following is the route :
>
> public class MyRouteBuilder extends RouteBuilder {
>  @Override
>  public void configure() throws Exception {
>       // xnc route here
>   String xncFileSupport = ICEndPoints.getValue(XNC_FILE_SUPPORT);
>   if (XNC_SUPPORT_ON.equalsIgnoreCase(xncFileSupport)) {
>    try {
>     InProcessor inproc = new InProcessor();
>     String rootXncFolder = ICEndPoints.getRootXNCFolder();
>       String sourceFolder =
>  getXNCSourceURI(pollDelayParameter,rootXncFolder);
>     AgentAuthProcessor authProc = new AgentAuthProcessor();
>     ConfigurationUtils utils = ConfigurationUtils.getInstance();
>     Configuration config = utils.getConfig();
>     String agentUserPwdUrl = MyUtils.getAgentUserPwdUrl(utils, config);
>     // xnc route starts here
>     from(sourceFolder)
>     // the exception clause here
>     .onException(Exception.class)
>     .maximumRedeliveries(redeliveryCount)
>     .redeliveryDelay(redeliveryDelay)
>     .logHandled(true)
>     .logRetryStackTrace(stackValue)
>     .retryAttemptedLogLevel(LoggingLevel.WARN)
>     .retriesExhaustedLogLevel(LoggingLevel.ERROR)
>     .backOffMultiplier(2.0)
>     .handled(true)
>     .to(SEDA_XNC_EXCEPTION)
>     .end()
>     .process(pickupProc)
>     .choice()
>        .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true))
>        .process(authProc)
>        .to(agentUserPwdUrl)
>        .otherwise()
>        .process(authProc)
>        .end()
>     .process(inproc)
>     .recipientList(header(Constants.DESTINATION_URI))
>     .process(new CommandResponseProcessor()) // try using xpath here also
>
>
>   }
>  }
> }
>
>
> I want to repeat the following steps from the route  based on a condition:
>
>  .choice()
> .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true))
> .process(authProc)
> .to(agentUserPwdUrl)
> .otherwise()
> .process(authProc)
> .end()
> .process(inproc)
> .recipientList(header(Constants.DESTINATION_URI))
>
> Iam using camel 2.4 , can you please suggest me how to repeat the above
> steps from the route based on a condition.
>
> Thanks,
> Chandana
>
>
>


-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: repeating the steps from the route

Posted by Christian Müller <ch...@gmail.com>.
We have a loop() in our DSL...

Sent from a mobile device
Am 08.01.2013 21:46 schrieb "Kesireddy, Chandana (ITD)" <
chandana.kesireddy@state.ma.us>:

> Following is the route :
>
> public class MyRouteBuilder extends RouteBuilder {
>  @Override
>  public void configure() throws Exception {
>       // xnc route here
>   String xncFileSupport = ICEndPoints.getValue(XNC_FILE_SUPPORT);
>   if (XNC_SUPPORT_ON.equalsIgnoreCase(xncFileSupport)) {
>    try {
>     InProcessor inproc = new InProcessor();
>     String rootXncFolder = ICEndPoints.getRootXNCFolder();
>       String sourceFolder =
>  getXNCSourceURI(pollDelayParameter,rootXncFolder);
>     AgentAuthProcessor authProc = new AgentAuthProcessor();
>     ConfigurationUtils utils = ConfigurationUtils.getInstance();
>     Configuration config = utils.getConfig();
>     String agentUserPwdUrl = MyUtils.getAgentUserPwdUrl(utils, config);
>     // xnc route starts here
>     from(sourceFolder)
>     // the exception clause here
>     .onException(Exception.class)
>     .maximumRedeliveries(redeliveryCount)
>     .redeliveryDelay(redeliveryDelay)
>     .logHandled(true)
>     .logRetryStackTrace(stackValue)
>     .retryAttemptedLogLevel(LoggingLevel.WARN)
>     .retriesExhaustedLogLevel(LoggingLevel.ERROR)
>     .backOffMultiplier(2.0)
>     .handled(true)
>     .to(SEDA_XNC_EXCEPTION)
>     .end()
>     .process(pickupProc)
>     .choice()
>        .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true))
>        .process(authProc)
>        .to(agentUserPwdUrl)
>        .otherwise()
>        .process(authProc)
>        .end()
>     .process(inproc)
>     .recipientList(header(Constants.DESTINATION_URI))
>     .process(new CommandResponseProcessor()) // try using xpath here also
>
>
>   }
>  }
> }
>
>
> I want to repeat the following steps from the route  based on a condition:
>
>  .choice()
> .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true))
> .process(authProc)
> .to(agentUserPwdUrl)
> .otherwise()
> .process(authProc)
> .end()
> .process(inproc)
> .recipientList(header(Constants.DESTINATION_URI))
>
> Iam using camel 2.4 , can you please suggest me how to repeat the above
> steps from the route based on a condition.
>
> Thanks,
> Chandana
>
>
>