public Boolean isRouteEnabled(Exchange exchange) { if (exchange.getFromRouteId() != null) { return perRoute.get(exchange.getFromRouteId()); } else { return true; } }
public Boolean isRouteEnabled(Exchange exchange) { if (exchange.getFromRouteId() != null) { return perRoute.get(exchange.getFromRouteId()); } else { return true; } }
@Override public boolean process(Exchange exchange, AsyncCallback callback) { // TODO: Remove this when CAMEL-4806 is in released Fuse Camel version exchange.getIn().setHeader("EcaRouteId", exchange.getFromRouteId()); return super.process(exchange, callback); } }
... @Override public void process(Exchange exchange) throws Exception { System.out.println("In ........"); try { File file = new File("soapbody.xml"); // generic body in separate XML file for every time DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(file); String body = doc.toString(); exchange.getIn().setBody(body ); } catch (Exception e) { e.printStackTrace(); } System.out.println("in process method"); System.out.println(exchange.getExchangeId() + " : " + exchange.getFromRouteId() + " : " + exchange.isFailed()); } ...
private String getFunnelCompId(Exchange exchange, MsgFunnelEndpoint endpoint) { if (endpoint.getId() != null) { // use custom ID return endpoint.getId(); } else { // create ID from route ID return FUNNEL_COMP_PREFIX + exchange.getFromRouteId(); } }
@Override public void process(Exchange exchange) throws Exception { ExportConfiguration exportConfig = (ExportConfiguration) exchange.getIn().getHeader(RouterConstants.HEADER_EXPORT_CONFIG); Map execution = new HashMap(); execution.put(RouterConstants.KEY_EXECS_DATE, ((Date) exchange.getProperty("CamelCreatedTimestamp")).getTime()); execution.put(RouterConstants.KEY_EXECS_EXTRACTED, exchange.getProperty("CamelSplitSize")); ExportConfiguration exportConfiguration = exportConfigurationService.load(exportConfig.getItemId()); exportConfiguration = (ExportConfiguration) RouterUtils.addExecutionEntry(exportConfiguration, execution, executionsHistorySize); exportConfiguration.setStatus(RouterConstants.CONFIG_STATUS_COMPLETE_SUCCESS); exportConfigurationService.save(exportConfiguration, false); logger.info("Processing route {} completed.", exchange.getFromRouteId()); }
protected String processList(List<CacheItem<Exchange>> list) throws IOException { String result = null; if (list != null && !list.isEmpty()) { ObjectMapper objectMapper = new ObjectMapper(); ObjectNode objectNode = objectMapper.createObjectNode(); ObjectNode rootNode = objectNode.putObject("eca{" + getPattern() + "}"); Map<String, List<CacheItem<Exchange>>> map = new LinkedHashMap<String, List<CacheItem<Exchange>>>(list.size()); for (CacheItem<Exchange> item : list) { Exchange exchange = item.getItem(); String routeId = exchange.getFromRouteId(); List<CacheItem<Exchange>> cl = map.get(routeId); if (cl == null) { cl = new ArrayList<CacheItem<Exchange>>(); map.put(routeId, cl); } cl.add(item); } processMap(objectMapper, rootNode, map); result = objectNode.toString(); } return result; }
/** * Evaluates the exchange */ protected void sendToConsumers(Exchange exchange) throws Exception { // ensure route id is correct set due CAMEL-4806 // TODO: Remove this when CAMEL-4806 is in released Fuse Camel version // and override prepareExchange method instead and set from route id detail there String routeId = (String) exchange.getIn().removeHeader("EcaRouteId"); if (exchange.getFromRouteId() == null) { exchange.setFromRouteId(routeId); } getEndpoint().evaluate(exchange); }
documentEvents.size(), exchange.getFromRouteId(), documentEvents);
importConfigId = importConfigOneShot.getItemId(); } else { importConfigId = exchange.getFromRouteId(); logger.info("Processing route {} completed. completion date: {}.", exchange.getFromRouteId(), new Date());
@Override public void onExchangeDone(Route route, Exchange exchange) { if (exchange != null && exchange.isFailed()) { Throwable t = exchange.getException(); if (t == null) { // this handles an alternative representation for exceptions in camel try { t = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class); } catch (RuntimeException e) { LOG.warn("Unable to handle exception in exchange in route: [{}]", exchange.getFromRouteId()); t = e; } } if (t != null) { doHandleFailedExchange(exchange, t); } } } }
eventsToDocuments.size(), exchange.getFromRouteId(), eventsToDocuments.values());
private BisExchangeEvent createBisEvent(Exchange exchange) { Date now = Date.from(Instant.now()); BisExchangeEvent bisExchangeEvent = new BisExchangeEvent(); Long property = exchange.getProperty(Exchange.BATCH_SIZE, Long.class); bisExchangeEvent.setBatchSize(property); bisExchangeEvent.setFromEndpoint(exchange.getFromEndpoint().getEndpointKey()); bisExchangeEvent.setFromRouteId(exchange.getFromRouteId()); bisExchangeEvent.setExchangeId(exchange.getExchangeId()); Date created = exchange.getProperty(Exchange.CREATED_TIMESTAMP, Date.class); bisExchangeEvent.setCreatedDate(created); bisExchangeEvent.setEndDate(now); bisExchangeEvent.setDuration(now.getTime() - created.getTime()); return bisExchangeEvent; } }
.setHeader(CitrusCamelMessageHeaders.ROUTE_ID, exchange.getFromRouteId()) .setHeader(CitrusCamelMessageHeaders.EXCHANGE_PATTERN, exchange.getPattern().name()) .setHeader(CitrusCamelMessageHeaders.EXCHANGE_FAILED, exchange.isFailed());
String fromId = exchange.getFromRouteId(); if (fromId == null) { fromId = exchange.getFromEndpoint().getEndpointUri();
String id = exchange.getFromRouteId(); if (id != null) {
private RouteExecution beginRouteExecution(Route route, Exchange exchange) { Date now = Date.from(Instant.now()); RouteExecution routeExchange = new RouteExecution(); routeExchange.setRouteBeginDate(now); routeExchange.setRouteId(route.getId()); routeExchange.setExchangeId(exchange.getExchangeId()); routeExchange.setMessageId(exchange.getIn().getMessageId()); routeExchange.setFromEndpointUri(exchange.getFromEndpoint().getEndpointUri()); routeExchange.setFromEndpointId(getEndpointId(exchange.getFromEndpoint())); routeExchange.setFromRouteId(exchange.getFromRouteId()); Date created = exchange.getProperty(Exchange.CREATED_TIMESTAMP, Date.class); routeExchange.setExchangeCreatedDate(created.getTime()); return routeExchange; }
String endpointId = ev.getEndpointURI(); String srcContextId = ev.getExchange().getContext().getName(); String srcRouteId = ev.getExchange().getFromRouteId();
this.sourceRouteId = source.getFromRouteId();