Ejemplo n.º 1
0
  @RequestMapping(value = "message/{index}", method = RequestMethod.POST)
  public String message(
      @RequestParam("endpointName") String endpointName,
      @PathVariable("index") int index,
      ModelMap map)
      throws Exception {

    CamelConnection conn = connectionFactory.getConnection();
    EndpointOperations ops = conn.getEndpointOperations(endpointName);

    Message message = ops.browseMessageAsXml(index, true);
    map.put("message", message);

    return "message";
  }
Ejemplo n.º 2
0
  @RequestMapping(method = RequestMethod.POST)
  public String show(@RequestParam("endpointName") String endpointName, ModelMap map)
      throws Exception {

    CamelConnection conn = connectionFactory.getConnection();
    EndpointOperations ops = conn.getEndpointOperations(endpointName);

    CamelBean endpoint = conn.getEndpoint(endpointName);
    long queueSize = ops.queueSize();
    endpoint.getProperties().put("queueSize()", queueSize);

    map.put("endpoint", endpoint);

    try {
      List<Message> messages =
          ops.browseRangeMessagesAsXml(0, Math.min((int) queueSize, MAX_OVERVIEW_MESSAGES), false);
      map.put("messages", messages);
    } catch (Exception e) {
    }

    return "endpoint";
  }