@Override public void configure() throws Exception { final JmsEndpoint endpoint = getContext().getEndpoint(String.format("queuingservice:%s?asyncConsumer=true", queueNameFactory.getName()), JmsEndpoint.class); final String selector = getJmsSelector(identity.getId()); LOG.trace("Using JMS selector: {} for module: {} on: {}", selector, module, identity); endpoint.setSelector(selector); from(endpoint).setExchangePattern(ExchangePattern.InOut) .process(new CamelRpcServerProcessor(module)) .routeId(getRouteId(module)); } }
@Override public void configure() throws Exception { final JmsEndpoint endpoint = getContext().getEndpoint(String.format("queuingservice:%s?asyncConsumer=true", queueNameFactory.getName()), JmsEndpoint.class); final String selector = getJmsSelector(identity.getId()); LOG.trace("Using JMS selector: {} for module: {} on: {}", selector, module, identity); endpoint.setSelector(selector); from(endpoint).setExchangePattern(ExchangePattern.InOut) .process(new CamelRpcServerProcessor(module)) .routeId(getRouteId(module)); } }
@Override public void configure() throws Exception { // Verify that the module returns a valid number. If number of threads is < 0, // creating the routes below does not work final int numberConsumerThrads = getNumConsumerThreads(module); final JmsQueueNameFactory queueNameFactory = new JmsQueueNameFactory( CamelSinkConstants.JMS_QUEUE_PREFIX, module.getId()); from(String.format("queuingservice:%s?concurrentConsumers=%d", queueNameFactory.getName(), numberConsumerThrads)) .setExchangePattern(ExchangePattern.InOnly) .process(new CamelSinkServerProcessor(consumerManager, module)) .routeId(getRouteId()); } }
@Override public void configure() throws Exception { from("jetty:http://0.0.0.0:8282/directMain").setExchangePattern(ExchangePattern.InOnly).recipientList().jsonpath("$.data.routeName").delimiter(",").end().process(new Processor() { @Override public void process(Exchange exchange) throws Exception { Message message = exchange.getIn(); System.out.println("OtherProcessor中的exchange" + exchange); InputStream body = (InputStream) message.getBody(); String str = IOUtils.toString(body, "UTF-8"); System.out.println("OtherProcessor str : " + str); // 存入到exchange的out区域 if (exchange.getPattern() == ExchangePattern.InOut) { Message outMessage = exchange.getOut(); outMessage.setBody(str + " || 被OtherProcessor处理"); } } }); }
@Override public void configure() throws Exception { final String requestQueueName = sqsManager.getRpcRequestQueueNameAndCreateIfNecessary(module.getId(), identity.getLocation()); final JmsEndpoint endpoint = getContext().getEndpoint(String.format("jms:queue:%s?connectionFactory=#connectionFactory" + "&correlationProperty=%s" + "&asyncConsumer=true", requestQueueName, AmazonSQSRPCConstants.AWS_SQS_CORRELATION_ID_HEADER), JmsEndpoint.class); from(endpoint).setExchangePattern(ExchangePattern.InOut) .process(new SystemIdFilterProcessor(identity.getId())) .process(new AmazonSQSServerProcessor(module)) .routeId(getRouteId(module)); } }
@Override public void configure() throws Exception { final String requestQueueName = sqsManager.getRpcRequestQueueNameAndCreateIfNecessary(module.getId(), identity.getLocation()); final JmsEndpoint endpoint = getContext().getEndpoint(String.format("jms:queue:%s?connectionFactory=#connectionFactory" + "&correlationProperty=%s" + "&asyncConsumer=true", requestQueueName, AmazonSQSRPCConstants.AWS_SQS_CORRELATION_ID_HEADER), JmsEndpoint.class); from(endpoint).setExchangePattern(ExchangePattern.InOut) .process(new SystemIdFilterProcessor(identity.getId())) .process(new AmazonSQSServerProcessor(module)) .routeId(getRouteId(module)); } }
@Override public void configure() { String state = container.getState(); CamelProcessor terminatingMailetProcessor = new CamelProcessor(metricFactory, container, new TerminatingMailet()); RouteDefinition processorDef = from(container.getEndpoint()) .routeId(state) .setExchangePattern(ExchangePattern.InOnly); for (MatcherMailetPair pair : pairs) { CamelProcessor mailetProccessor = new CamelProcessor(metricFactory, container, pair.getMailet()); MatcherSplitter matcherSplitter = new MatcherSplitter(metricFactory, container, pair); processorDef // do splitting of the mail based on the stored matcher .split().method(matcherSplitter) .aggregationStrategy(new UseLatestAggregationStrategy()) .process(exchange -> handleMailet(exchange, container, mailetProccessor)); } processorDef .process(exchange -> terminateSmoothly(exchange, container, terminatingMailetProcessor)); }