View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.service.processor;
8   
9   import org.mule.api.source.MessageSource;
10  import org.mule.routing.requestreply.AbstractAsyncRequestReplyRequester;
11  import org.mule.service.ServiceAsyncReplyCompositeMessageSource;
12  
13  public class ServiceAsyncRequestReplyRequestor extends AbstractAsyncRequestReplyRequester
14  {
15  
16      protected void postLatchAwait(String asyncReplyCorrelationId)
17      {
18          if (replyMessageSource instanceof ServiceAsyncReplyCompositeMessageSource)
19          {
20              ((ServiceAsyncReplyCompositeMessageSource) replyMessageSource).expireAggregation(asyncReplyCorrelationId);
21          }
22      }
23  
24      @Override
25      protected void verifyReplyMessageSource(MessageSource messageSource)
26      {
27          if (!(messageSource instanceof ServiceAsyncReplyCompositeMessageSource))
28          {
29              throw new IllegalArgumentException(
30                  "ServiceAsyncReplyCompositeMessageSource async reply MessageSource must be used with ServiceAsyncRequestReplyRequestor");
31          }
32      }
33  }