Ejemplo n.º 1
0
  public UMOMessage getResponse(UMOMessage message) throws RoutingException {
    UMOMessage result = null;
    if (routers.size() == 0) {
      result = message;
    } else {
      UMOResponseRouter router = null;
      for (Iterator iterator = getRouters().iterator(); iterator.hasNext(); ) {
        router = (UMOResponseRouter) iterator.next();
        result = router.getResponse(message);
      }

      if (result == null) {
        // Update stats
        if (getStatistics().isEnabled()) {
          getStatistics().incrementNoRoutedMessage();
        }
      }
    }

    if (result != null && transformer != null) {
      try {
        result =
            new MuleMessage(transformer.transform(result.getPayload()), result.getProperties());
      } catch (TransformerException e) {
        throw new RoutingException(result, null);
      }
    }
    return result;
  }
Ejemplo n.º 2
0
 public void route(UMOEvent event) throws RoutingException {
   UMOResponseRouter router = null;
   for (Iterator iterator = getRouters().iterator(); iterator.hasNext(); ) {
     router = (UMOResponseRouter) iterator.next();
     router.process(event);
     // Update stats
     if (getStatistics().isEnabled()) {
       getStatistics().incrementRoutedMessage(event.getEndpoint());
     }
   }
 }