@Override public void configure() throws Exception { weaveAddLast().to(mockEndpointURI); } });
protected <T extends ProcessorDefinition> T addInterimProc(T route) { if (interimProc != null) { route.process(interimProc); } return route; } }
public static ProcessorDefinition<?> setHeader(ProcessorDefinition<?> self, String name, Closure<?> expression) { return self.setHeader(name, toExpression(expression)); }
protected void appendStats(StringBuilder sb, ProcessorDefinition<?> definition) { Stats stats = statistics.get(definition); if (stats != null) { sb.append("<processor"); if (definition.getId() != null) { sb.append(" id=\"").append(definition.getId()).append("\""); } sb.append(" definition=\"").append(StringHelper.xmlEncode(definition.toString())).append("\""); if (definition.getLabel() != null) { sb.append(" label=\"").append(definition.getLabel()).append("\""); } sb.append(" count=\"").append(stats.getCount()).append("\""); sb.append(" self=\"").append(stats.getSelf()).append("\""); sb.append(" total=\"").append(stats.getTotal()).append("\""); sb.append(">"); for (ProcessorDefinition<?> child : statistics.keySet()) { if (child.getParent() == definition) { appendStats(sb, child); } } sb.append("</processor>"); } }
.bean(this, "setEntityInfo") .setHeader(MSG_HEADER, body()) .transform(simple("${body.payload}")) .removeHeader(TraceHeaderProcessor.TRACE_HEADER) .removeHeader(SpringWebserviceConstants.SPRING_WS_SOAP_HEADER) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { .routingSlip(method(ROUTE_BEAN, "nextRoute")) .end(); .validate(exchangeProperty(Exchange.EXCEPTION_CAUGHT).isNotNull()) .stop(); .bean(MessageService.BEAN, "setStateFailed") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { .to(AsynchConstants.URI_POST_PROCESS_AFTER_FAILED)
String functionName = function.getName(); if (!Strings.isEmpty(functionName)) { route.to("json:marshal"); String method = null; int idx = functionName.indexOf("::"); route = route.to(uri); if (!Strings.isEmpty(uri)) { uri = convertEndpointURI(uri); route = route.to("json:marshal"); route = route.to(uri); route.setBody(constant(step.getBody())); } else if (item instanceof Throttle) { Throttle step = (Throttle) item; ThrottleDefinition throttle = route.throttle(step.getMaximumRequests()); Long period = step.getPeriodMillis(); if (period != null) { String key = entry.getKey(); Object value = entry.getValue(); route.setHeader(key, constant(value)); Filter step = (Filter) item; Predicate predicate = getMandatoryPredicate(step, step.getExpression(), step.getLanguage()); FilterDefinition filter = route.filter(predicate); addSteps(filter, step.getSteps()); } else if (item instanceof Split) {
.otherwise(); pd.wireTap(orderCheckMock.getEndpointUri()) .log(LoggingLevel.INFO, "Endpoint ${property.endpointUri} received a message"); pd.process(mockDefinition.getMockFeedPreprocessor()); pd.to(mockEndpoint) .log(LoggingLevel.DEBUG, "Endpoint ${property.endpointUri} returning back to the client body: ${body}, headers: ${headers}") .end(); .convertBodyTo(byte[].class) .doCatch(Throwable.class).end() .choice().when(property(Exchange.EXCEPTION_CAUGHT).isNotNull()) .log(LoggingLevel.DEBUG, "Received exception response to endpoint " + spec.getEndpointUri() + " exception: ${exception}, headers: ${headers}")
@Override public void configure() throws Exception { from("file://in").id("file2jms") .to("jms:person"); from("jms:person").id("personJms2Rest") // .onException(ConnectException.class).log("Exception processing message.. does the personservice run?").end() .setHeader("person_id", xpath("/person/id").stringResult()) .to("log:test") .setHeader(Exchange.HTTP_METHOD, constant("PUT")) .setHeader(Exchange.CONTENT_TYPE, constant("text/xml")) .setHeader(Exchange.HTTP_URI, simple("${properties:personServiceUri}/${header.person_id}")) // .to("http://dummy"); }
.choice() .when(header(EVENT_TYPE).isEqualTo(REPOSITORY + "NODE_REMOVED")) .to("direct:delete") .routeId("JsonLdRouter") .setHeader(FCREPO_IDENTIFIER).simple("${headers[" + HTTP_PATH + "]}") .choice() .when(header(HTTP_METHOD).isEqualTo("GET")).to("direct:get") .when(header(HTTP_METHOD).isEqualTo("PUT")).to("direct:update") .filter(header(HTTP_RESPONSE_CODE).isEqualTo(200)) .setHeader(HTTP_METHOD).constant("PUT") .process(new RiakKeyBuilder()) .log("Updating cache entry for: ${headers[CamelFcrepoIdentifier]}") .to("http4://{{riak.host}}"); .routeId("JsonLdDelete") .setHeader(HTTP_METHOD).constant("DELETE") .process(new RiakKeyBuilder()) .log("Deleting cache entry for: ${headers[CamelFcrepoIdentifier]}") .to("http4://{{riak.host}}"); .removeHeader("User-Agent") .setHeader(FCREPO_BASE_URL).simple("{{fcrepo.baseUrl}}") .to("fcrepo:{{fcrepo.baseUrl}}?accept=application/ld+json&throwExceptionOnFailure=false");
prDefErr.to((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_FROM, RouterConstants.DIRECT_IMPORT_DEPOSIT_BUFFER)); } else { prDefErr.to((String) getEndpointURI(RouterConstants.DIRECTION_FROM, RouterConstants.DIRECT_IMPORT_DEPOSIT_BUFFER)); .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { .split(bodyAs(String.class).tokenize(importConfiguration.getLineSeparator())) .log(LoggingLevel.DEBUG, "Splitted into ${exchangeProperty.CamelSplitSize} records") .setHeader(RouterConstants.HEADER_CONFIG_TYPE, constant(configType)) prDef.to((KafkaEndpoint) getEndpointURI(RouterConstants.DIRECTION_FROM, RouterConstants.DIRECT_IMPORT_DEPOSIT_BUFFER)); } else { prDef.to((String) getEndpointURI(RouterConstants.DIRECTION_FROM, RouterConstants.DIRECT_IMPORT_DEPOSIT_BUFFER));
@Override public void configure() throws Exception { from("direct:input") // Enable the following statement if error handling // has been globally turned off via noErrorHandler(), // otherwise exception() statements have no effect. //.errorHandler(deadLetterChannel()) .onException(Exception1.class).to("mock:error1").end() .onException(Exception2.class).to("mock:error2").end() .onException(Exception.class).to("mock:error3").end() .process(exceptionProcessor()) .to("mock:success"); }
parent = parent.setHeader(IntegrationLoggingConstants.FLOW_ID, constant(flowId)); parent = definition.get(); parent = configureRouteDefinition(parent, flowName, flowId, stepId); parent = parent.setHeader(IntegrationLoggingConstants.FLOW_ID, constant(flowId)); parent = parent.setHeader(IntegrationLoggingConstants.STEP_ID, constant(stepId)); parent = configureConnectorSplit(step, parent, flowIndex, stepIndex).orElse(parent); parent = parent.process(OutMessageCaptureProcessor.INSTANCE); if (i > 0) { if (parent instanceof PipelineDefinition) { parent = parent.end(); } else if (parent instanceof ExpressionNode) { parent = parent.endParent(); parent = parent.setHeader(IntegrationLoggingConstants.STEP_ID, constant(stepId)); parent = parent.process(new OutMessageCaptureProcessor()); } else { if (parent instanceof PipelineDefinition) { parent = parent.process(OutMessageCaptureProcessor.INSTANCE); parent = parent.end(); } else if (parent instanceof ExpressionNode) { parent = parent.process(OutMessageCaptureProcessor.INSTANCE); parent = parent.endParent(); } else { parent = parent.process(OutMessageCaptureProcessor.INSTANCE);
/** * Creates route definition applicable for actual camel binding model. * * @return Route definition handling given binding. */ protected RouteDefinition createRouteDefinition() { final RouteDefinition route = new RouteDefinition(); route.routeId(getRouteId()).from(getComponentUri().toString()); addTransactionPolicy(route); addNamespacePolicy(route); route.setProperty(ExchangeCompletionEvent.GATEWAY_NAME).simple(getBindingModel().getName(), String.class) .setProperty(CamelConstants.APPLICATION_NAMESPACE).constant(_serviceName.getNamespaceURI()) .process(new MessageComposerProcessor(getBindingModel())) .process(new OperationSelectorProcessor(getServiceName(), getBindingModel())) .to(getSwitchyardEndpointUri()); return route; }
.maximumRedeliveries(0) .end() .removeHeaders("CamelSmpp*")//In case it started as SMS elsewhere .process(origin) .process(destination) .choice() .when(blacklistedDestination) .to(dlq)
@Override public void configure() throws Exception { from("xds-iti41:continuaHRNService") .onException(Exception.class) .maximumRedeliveries(0) .end() .process(ContinuaHrnCamelProcessors.continuaHrnRequestTransformerAndValidator()) .process(CHECK_PROCESSOR) .setBody(constant(new Response(Status.SUCCESS))) .process(ContinuaHrnCamelProcessors.continuaHrnResponseValidator()); }