@SuppressWarnings("unused") public String forward(String body, @Headers Map<String, Object> headers, @Properties Map<String, Object> properties, @Header(Exchange.SLIP_ENDPOINT) String previous) { if (previous == null) { Object routing = headers.get("router-header"); return routing != null ? ("direct:" + routing) : null; } // no more so return null return null; }
public String slip(String body, @Properties Map<String, Object> properties) { log.info("slip " + properties.get("EXIT")); if (properties.get("EXIT") != null && properties.get("EXIT").equals("PLEASE")) { log.info("Exiting after " + MAX_ITERATIONS + " iterations"); return null; } else { return "direct:while_body"; } }
/** * Use this method to compute dynamic where we should route next. * * @param body the message body * @param properties the exchange properties where we can store state between invocations * @return endpoints to go, or <tt>null</tt> to indicate the end */ public String slip(String body, @Properties Map<String, Object> properties) { bodies.add(body); // get the state from the exchange properties and keep track how many times // we have been invoked int invoked = 0; Object current = properties.get("invoked"); if (current != null) { invoked = Integer.valueOf(current.toString()); } invoked++; // and store the state back on the properties properties.put("invoked", invoked); if (invoked == 1) { return "mock:a"; } else if (invoked == 2) { return "mock:b,mock:c"; } else if (invoked == 3) { return "direct:foo"; } else if (invoked == 4) { return "mock:result"; } // no more so return null return null; }
public void myMethod(@Properties Map<?, ?> foo, @Headers Map<?, ?> bar, @Body String body) { this.foo = foo; this.bar = bar; this.body = body; assertNotNull(toString()); }
public String routeServiceTest( @Header("serviceTestName") String serviceTestName, @Properties Map<String, Object> properties) { String endPoint = null; int invoked = 0; // property will be null on first call Object current = properties.get("invoked"); if (current != null) { invoked = Integer.valueOf(current.toString()); } if (invoked == 0) { switch (serviceTestName) { case "ping": endPoint = "seda:ping-check"; break; case "port": endPoint = "seda:port-check"; break; default: assert false; } } invoked++; properties.put("invoked", invoked); return endPoint; }
public void myMethod(@Properties Map<?, ?> foo, @Headers Map<?, ?> bar) { this.foo = foo; this.bar = bar; LOG.info("myMethod() method called on " + this); }
/** * Changes state of the message to {@link MsgStateEnum#OK}. * <p/> * If message is child message then method checks if all child messages of the parent message aren't processed. * * @param msg the message * @param props the exchange properties [property name; property value] */ void setStateOk(@Header(MSG_HEADER) Message msg, @Properties Map<String, Object> props);
/** * Changes state of the message to {@link MsgStateEnum#PARTLY_FAILED}. * * @param msg the message * @param ex the exception * @param errCode the error code that can be explicitly defined if needed * @param customData the custom data * @param props the exchange properties [property name; property value] */ void setStatePartlyFailed(@Header(MSG_HEADER) Message msg, Exception ex, @Property(EXCEPTION_ERROR_CODE) @Nullable ErrorExtEnum errCode, @Property(CUSTOM_DATA_PROP) @Nullable String customData, @Properties Map<String, Object> props);
/** * Changes state of the message to {@link MsgStateEnum#FAILED}. * <p/> * If message is child message then parent message will be marked as failed too. * * @param msg the message * @param ex the exception * @param errCode the error code that can be explicitly defined if needed * @param customData the custom data * @param props the exchange properties [property name; property value] */ void setStateFailed(@Header(MSG_HEADER) Message msg, Exception ex, @Property(EXCEPTION_ERROR_CODE) @Nullable ErrorExtEnum errCode, @Property(CUSTOM_DATA_PROP) @Nullable String customData, @Properties Map<String, Object> props);