org.apache.camel.processor.aggregate.AggregationStrategy Java Examples
The following examples show how to use
org.apache.camel.processor.aggregate.AggregationStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
protected AggregationStrategy getAggregationStrategy(Exchange exchange) { AggregationStrategy answer = null; // prefer to use per Exchange aggregation strategy over a global strategy if (exchange != null) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map != null) { answer = map.get(this); } } if (answer == null) { // fallback to global strategy answer = getAggregationStrategy(); } return answer; }
Example #2
Source File: patched.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
protected AggregationStrategy getAggregationStrategy(Exchange exchange) { AggregationStrategy answer = null; // prefer to use per Exchange aggregation strategy over a global strategy if (exchange != null) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map != null) { answer = map.get(this); } } if (answer == null) { // fallback to global strategy answer = getAggregationStrategy(); } return answer; }
Example #3
Source File: patched.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
/** * Sets the given {@link org.apache.camel.processor.aggregate.AggregationStrategy} on the {@link Exchange}. * * @param exchange the exchange * @param aggregationStrategy the strategy */ protected void setAggregationStrategyOnExchange(Exchange exchange, AggregationStrategy aggregationStrategy) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { map = new ConcurrentHashMap<Object, AggregationStrategy>(); } else { // it is not safe to use the map directly as the exchange doesn't have the deep copy of it's properties // we just create a new copy if we need to change the map map = new ConcurrentHashMap<Object, AggregationStrategy>(map); } // store the strategy using this processor as the key // (so we can store multiple strategies on the same exchange) map.put(this, aggregationStrategy); exchange.setProperty(Exchange.AGGREGATION_STRATEGY, map); }
Example #4
Source File: patched.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork, boolean parallelAggregate) { notNull(camelContext, "camelContext"); this.camelContext = camelContext; this.processors = processors; this.aggregationStrategy = aggregationStrategy; this.executorService = executorService; this.shutdownExecutorService = shutdownExecutorService; this.streaming = streaming; this.stopOnException = stopOnException; // must enable parallel if executor service is provided this.parallelProcessing = parallelProcessing || executorService != null; this.timeout = timeout; this.onPrepare = onPrepare; this.shareUnitOfWork = shareUnitOfWork; this.parallelAggregate = parallelAggregate; }
Example #5
Source File: original.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork, boolean parallelAggregate) { notNull(camelContext, "camelContext"); this.camelContext = camelContext; this.processors = processors; this.aggregationStrategy = aggregationStrategy; this.executorService = executorService; this.shutdownExecutorService = shutdownExecutorService; this.streaming = streaming; this.stopOnException = stopOnException; // must enable parallel if executor service is provided this.parallelProcessing = parallelProcessing || executorService != null; this.timeout = timeout; this.onPrepare = onPrepare; this.shareUnitOfWork = shareUnitOfWork; this.parallelAggregate = parallelAggregate; }
Example #6
Source File: original.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
protected AggregationStrategy getAggregationStrategy(Exchange exchange) { AggregationStrategy answer = null; // prefer to use per Exchange aggregation strategy over a global strategy if (exchange != null) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map != null) { answer = map.get(this); } } if (answer == null) { // fallback to global strategy answer = getAggregationStrategy(); } return answer; }
Example #7
Source File: original.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
/** * Sets the given {@link org.apache.camel.processor.aggregate.AggregationStrategy} on the {@link Exchange}. * * @param exchange the exchange * @param aggregationStrategy the strategy */ protected void setAggregationStrategyOnExchange(Exchange exchange, AggregationStrategy aggregationStrategy) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { map = new ConcurrentHashMap<Object, AggregationStrategy>(); } else { // it is not safe to use the map directly as the exchange doesn't have the deep copy of it's properties // we just create a new copy if we need to change the map map = new ConcurrentHashMap<Object, AggregationStrategy>(map); } // store the strategy using this processor as the key // (so we can store multiple strategies on the same exchange) map.put(this, aggregationStrategy); exchange.setProperty(Exchange.AGGREGATION_STRATEGY, map); }
Example #8
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
/** * Sets the given {@link org.apache.camel.processor.aggregate.AggregationStrategy} on the {@link Exchange}. * * @param exchange the exchange * @param aggregationStrategy the strategy */ protected void setAggregationStrategyOnExchange(Exchange exchange, AggregationStrategy aggregationStrategy) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { map = new ConcurrentHashMap<Object, AggregationStrategy>(); } else { // it is not safe to use the map directly as the exchange doesn't have the deep copy of it's properties // we just create a new copy if we need to change the map map = new ConcurrentHashMap<Object, AggregationStrategy>(map); } // store the strategy using this processor as the key // (so we can store multiple strategies on the same exchange) map.put(this, aggregationStrategy); exchange.setProperty(Exchange.AGGREGATION_STRATEGY, map); }
Example #9
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
protected AggregationStrategy getAggregationStrategy(Exchange exchange) { AggregationStrategy answer = null; // prefer to use per Exchange aggregation strategy over a global strategy if (exchange != null) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map != null) { answer = map.get(this); } } if (answer == null) { // fallback to global strategy answer = getAggregationStrategy(); } return answer; }
Example #10
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork, boolean parallelAggregate) { notNull(camelContext, "camelContext"); this.camelContext = camelContext; this.processors = processors; this.aggregationStrategy = aggregationStrategy; this.executorService = executorService; this.shutdownExecutorService = shutdownExecutorService; this.streaming = streaming; this.stopOnException = stopOnException; // must enable parallel if executor service is provided this.parallelProcessing = parallelProcessing || executorService != null; this.timeout = timeout; this.onPrepare = onPrepare; this.shareUnitOfWork = shareUnitOfWork; this.parallelAggregate = parallelAggregate; }
Example #11
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork, boolean parallelAggregate) { notNull(camelContext, "camelContext"); this.camelContext = camelContext; this.processors = processors; this.aggregationStrategy = aggregationStrategy; this.executorService = executorService; this.shutdownExecutorService = shutdownExecutorService; this.streaming = streaming; this.stopOnException = stopOnException; // must enable parallel if executor service is provided this.parallelProcessing = parallelProcessing || executorService != null; this.timeout = timeout; this.onPrepare = onPrepare; this.shareUnitOfWork = shareUnitOfWork; this.parallelAggregate = parallelAggregate; }
Example #12
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
/** * Sets the given {@link org.apache.camel.processor.aggregate.AggregationStrategy} on the {@link Exchange}. * * @param exchange the exchange * @param aggregationStrategy the strategy */ protected void setAggregationStrategyOnExchange(Exchange exchange, AggregationStrategy aggregationStrategy) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { map = new ConcurrentHashMap<Object, AggregationStrategy>(); } else { // it is not safe to use the map directly as the exchange doesn't have the deep copy of it's properties // we just create a new copy if we need to change the map map = new ConcurrentHashMap<Object, AggregationStrategy>(map); } // store the strategy using this processor as the key // (so we can store multiple strategies on the same exchange) map.put(this, aggregationStrategy); exchange.setProperty(Exchange.AGGREGATION_STRATEGY, map); }
Example #13
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork, boolean parallelAggregate) { notNull(camelContext, "camelContext"); this.camelContext = camelContext; this.processors = processors; this.aggregationStrategy = aggregationStrategy; this.executorService = executorService; this.shutdownExecutorService = shutdownExecutorService; this.streaming = streaming; this.stopOnException = stopOnException; // must enable parallel if executor service is provided this.parallelProcessing = parallelProcessing || executorService != null; this.timeout = timeout; this.onPrepare = onPrepare; this.shareUnitOfWork = shareUnitOfWork; this.parallelAggregate = parallelAggregate; }
Example #14
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
/** * Sets the given {@link org.apache.camel.processor.aggregate.AggregationStrategy} on the {@link Exchange}. * * @param exchange the exchange * @param aggregationStrategy the strategy */ protected void setAggregationStrategyOnExchange(Exchange exchange, AggregationStrategy aggregationStrategy) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { map = new ConcurrentHashMap<Object, AggregationStrategy>(); } else { // it is not safe to use the map directly as the exchange doesn't have the deep copy of it's properties // we just create a new copy if we need to change the map map = new ConcurrentHashMap<Object, AggregationStrategy>(map); } // store the strategy using this processor as the key // (so we can store multiple strategies on the same exchange) map.put(this, aggregationStrategy); exchange.setProperty(Exchange.AGGREGATION_STRATEGY, map); }
Example #15
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
protected AggregationStrategy getAggregationStrategy(Exchange exchange) { AggregationStrategy answer = null; // prefer to use per Exchange aggregation strategy over a global strategy if (exchange != null) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map != null) { answer = map.get(this); } } if (answer == null) { // fallback to global strategy answer = getAggregationStrategy(); } return answer; }
Example #16
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
protected AggregationStrategy getAggregationStrategy(Exchange exchange) { AggregationStrategy answer = null; // prefer to use per Exchange aggregation strategy over a global strategy if (exchange != null) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map != null) { answer = map.get(this); } } if (answer == null) { // fallback to global strategy answer = getAggregationStrategy(); } return answer; }
Example #17
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
/** * Sets the given {@link org.apache.camel.processor.aggregate.AggregationStrategy} on the {@link Exchange}. * * @param exchange the exchange * @param aggregationStrategy the strategy */ protected void setAggregationStrategyOnExchange(Exchange exchange, AggregationStrategy aggregationStrategy) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { map = new ConcurrentHashMap<Object, AggregationStrategy>(); } else { // it is not safe to use the map directly as the exchange doesn't have the deep copy of it's properties // we just create a new copy if we need to change the map map = new ConcurrentHashMap<Object, AggregationStrategy>(map); } // store the strategy using this processor as the key // (so we can store multiple strategies on the same exchange) map.put(this, aggregationStrategy); exchange.setProperty(Exchange.AGGREGATION_STRATEGY, map); }
Example #18
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork, boolean parallelAggregate) { notNull(camelContext, "camelContext"); this.camelContext = camelContext; this.processors = processors; this.aggregationStrategy = aggregationStrategy; this.executorService = executorService; this.shutdownExecutorService = shutdownExecutorService; this.streaming = streaming; this.stopOnException = stopOnException; // must enable parallel if executor service is provided this.parallelProcessing = parallelProcessing || executorService != null; this.timeout = timeout; this.onPrepare = onPrepare; this.shareUnitOfWork = shareUnitOfWork; this.parallelAggregate = parallelAggregate; }
Example #19
Source File: MulticastWithAggregationOfRequestRoute.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override public void configure() throws Exception { AggregationStrategy concatenationStrategy = new ConcatenatingAggregationStrategy(); from("direct:start") .enrich("direct:performMulticast", concatenationStrategy) .transform(body()); // copy the In message to the Out message; this will become the route response from("direct:performMulticast") .multicast().aggregationStrategy(concatenationStrategy) .to("direct:first") .to("direct:second") .end(); from("direct:first") .transform(constant("first response")); from("direct:second") .transform(constant("second response")); }
Example #20
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
/** * Removes the associated {@link org.apache.camel.processor.aggregate.AggregationStrategy} from the {@link Exchange} * which must be done after use. * * @param exchange the current exchange */ protected void removeAggregationStrategyFromExchange(Exchange exchange) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { return; } // remove the strategy using this processor as the key map.remove(this); }
Example #21
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
@Deprecated public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork) { this(camelContext, processors, aggregationStrategy, parallelProcessing, executorService, shutdownExecutorService, streaming, stopOnException, timeout, onPrepare, shareUnitOfWork, false); }
Example #22
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
@Deprecated public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork) { this(camelContext, processors, aggregationStrategy, parallelProcessing, executorService, shutdownExecutorService, streaming, stopOnException, timeout, onPrepare, shareUnitOfWork, false); }
Example #23
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
@Deprecated public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork) { this(camelContext, processors, aggregationStrategy, parallelProcessing, executorService, shutdownExecutorService, streaming, stopOnException, timeout, onPrepare, shareUnitOfWork, false); }
Example #24
Source File: original.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
/** * Removes the associated {@link org.apache.camel.processor.aggregate.AggregationStrategy} from the {@link Exchange} * which must be done after use. * * @param exchange the current exchange */ protected void removeAggregationStrategyFromExchange(Exchange exchange) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { return; } // remove the strategy using this processor as the key map.remove(this); }
Example #25
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
/** * Removes the associated {@link org.apache.camel.processor.aggregate.AggregationStrategy} from the {@link Exchange} * which must be done after use. * * @param exchange the current exchange */ protected void removeAggregationStrategyFromExchange(Exchange exchange) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { return; } // remove the strategy using this processor as the key map.remove(this); }
Example #26
Source File: original.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
@Deprecated public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork) { this(camelContext, processors, aggregationStrategy, parallelProcessing, executorService, shutdownExecutorService, streaming, stopOnException, timeout, onPrepare, shareUnitOfWork, false); }
Example #27
Source File: patched.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
/** * Removes the associated {@link org.apache.camel.processor.aggregate.AggregationStrategy} from the {@link Exchange} * which must be done after use. * * @param exchange the current exchange */ protected void removeAggregationStrategyFromExchange(Exchange exchange) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { return; } // remove the strategy using this processor as the key map.remove(this); }
Example #28
Source File: file_s.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
/** * Removes the associated {@link org.apache.camel.processor.aggregate.AggregationStrategy} from the {@link Exchange} * which must be done after use. * * @param exchange the current exchange */ protected void removeAggregationStrategyFromExchange(Exchange exchange) { Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class); Map<Object, AggregationStrategy> map = CastUtils.cast(property); if (map == null) { return; } // remove the strategy using this processor as the key map.remove(this); }
Example #29
Source File: patched.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
@Deprecated public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork) { this(camelContext, processors, aggregationStrategy, parallelProcessing, executorService, shutdownExecutorService, streaming, stopOnException, timeout, onPrepare, shareUnitOfWork, false); }
Example #30
Source File: file_t.java From gumtree-spoon-ast-diff with Apache License 2.0 | 5 votes |
@Deprecated public MulticastProcessor(CamelContext camelContext, Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean shutdownExecutorService, boolean streaming, boolean stopOnException, long timeout, Processor onPrepare, boolean shareUnitOfWork) { this(camelContext, processors, aggregationStrategy, parallelProcessing, executorService, shutdownExecutorService, streaming, stopOnException, timeout, onPrepare, shareUnitOfWork, false); }