View Javadoc

1   /*
2    * $Id: SleepyFileMessageDispatcher.java 22653 2011-08-12 05:29:45Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.test.construct;
12  
13  import org.mule.api.MuleEvent;
14  import org.mule.api.endpoint.OutboundEndpoint;
15  import org.mule.transport.file.FileMessageDispatcher;
16  
17  public class SleepyFileMessageDispatcher extends FileMessageDispatcher
18  {
19      public SleepyFileMessageDispatcher(OutboundEndpoint endpoint)
20      {
21          super(endpoint);
22      }
23  
24      @Override
25      protected void doDispatch(MuleEvent event) throws Exception
26      {
27          String sleepTime = event.getMessage().getInvocationProperty(
28              FlowSyncAsyncProcessingStrategyTestCase.SLEEP_TIME);
29  
30          Thread.sleep(Integer.valueOf(sleepTime));
31  
32          super.doDispatch(event);
33  
34      }
35  
36  }